Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] [PL] Make [hidden] a conditional attribute #1711

Open
1 task
Kein opened this issue May 24, 2024 · 3 comments
Open
1 task

[Feature] [PL] Make [hidden] a conditional attribute #1711

Kein opened this issue May 24, 2024 · 3 comments

Comments

@Kein
Copy link

Kein commented May 24, 2024

What feature would you like to see?

[[hidden("true/false")]]

How will this feature be useful to you and others?

This will allow to conditionally hide some variables/pattern values depending on the parsing result

Request Type

  • I can provide a PoC for this feature or am willing to work on it myself and submit a PR

Additional context?

No response

@paxcut
Copy link
Contributor

paxcut commented May 25, 2024

Why only for [[hidden]]? Anyway, this has been asked already in a pattern language issue and partially addressed there.

@paxcut
Copy link
Contributor

paxcut commented Aug 1, 2024

Isn't this the same thing?

if (condition)
    SomeType var;
else
     padding[sizeof(SomeType)];//or maybe SomeType var[[hidden]];

and that has always been possible. As for arbitrary conditional attribute with parameters you can use the ternary conditional operator to set the parameter value which in effect is the feature requested in issue #16. If nameString and indexString are defined in pattern then the following already works.

} [[name(value==35 ? nameString : "["+indexString+"]")]];

@Kein
Copy link
Author

Kein commented Aug 2, 2024

The idea is:

[[hidden(value==35)]]

More clear and concise, succinct declaration, easier to read

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants