You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prompt: What is your project URL?default:
if: git.remote_providereval: 'https://{{ git.remote_provider }}/{{ git.remote_owner }}/{{ git.remote_name }}'else:
eval: Enter some url ...
However, if takes precedence over all other commands and expressions in its node, which particularly means read cannot work with ternary expressions:
read: xif: some conditioneval: some valueelse:
eval: some other value
👆 this code will read x if some condition holds, but won't read it otherwise (will just evaluate some other value to oblivion), since if takes precedence over read.
this can be simply fixed by introducing an expression similar to if but with lower priority (right below read):
read: xwhere: some conditioneval: some valueelse:
eval: some other value
👆 this code will ALWAYS read x, even without an else clause it would read it into an empty string.
this is fairly straightforward since it is a copy of if rule, however it requires further contemplation of whether it is worth adding to syntax complexity for the convenience of read command (and only read command).
Pros
Convenient reads with ternary expressions
??
Cons
In a lot of cases, if and where will be interchangeable, i.e. two ways to do the same thing, which increases difficulty of reading recipe code.
In cases that they are not, it might be confusing.
Potential clash with this proposal. This is not a case of actual syntax ambiguity, since where would have lower priority to copy/update/remove (and other such commands). However it might result in increased difficulty of reading recipe code.
??
This should be further contemplated. For now, I will add the code and tests for the where rule, without adding it to the standard ruleset (should it be a parametrised if rule instead?)
The text was updated successfully, but these errors were encountered:
if
is now an expression, which means we have ternary expressions like this:However,
if
takes precedence over all other commands and expressions in its node, which particularly meansread
cannot work with ternary expressions:👆 this code will read x if some condition holds, but won't read it otherwise (will just evaluate some other value to oblivion), since
if
takes precedence overread
.this can be simply fixed by introducing an expression similar to
if
but with lower priority (right belowread
):👆 this code will ALWAYS read x, even without an else clause it would read it into an empty string.
this is fairly straightforward since it is a copy of if rule, however it requires further contemplation of whether it is worth adding to syntax complexity for the convenience of
read
command (and onlyread
command).Pros
Cons
if
andwhere
will be interchangeable, i.e. two ways to do the same thing, which increases difficulty of reading recipe code.where
would have lower priority tocopy
/update
/remove
(and other such commands). However it might result in increased difficulty of reading recipe code.This should be further contemplated. For now, I will add the code and tests for the
where
rule, without adding it to the standard ruleset (should it be a parametrisedif
rule instead?)The text was updated successfully, but these errors were encountered: