Closed s2b closed 2 months ago
First step to accomplish this would be to "block" some variable names by throwing a deprecation: true
, false
, null
and _all
.
The end result could look something like this:
<my:viewhelper disabled="{false}" />
<my:viewhelper disabled="{falsyVariable}" />
<my:viewhelper disabled="{someVariable as bool}" />
<my:viewhelper disabled="{myString == 'test'}" />
Currently, it is dependent on the context if
true
/false
/1
/0
will be converted to booleans or if the values will remain as-is. This can lead to confusing behavior, for example for a TagBasedViewHelper:This will lead to something like this:
However, one would expect the following result:
However, we can't just convert
true
orfalse
to boolean in all places because there are cases where you would want the string"true"
instead. So we probably need some kind of syntax to decide explicitly, which type should be used.One possibility is to solve this similarly to frontend frameworks (such as Svelte):
Same goes for
null
, which should be treated similarly totrue
andfalse
.