Multiple times we've run into issues when some boolean attribute is added to a view, then we forget to pass it, the code compiles, but the attribute is false by default.
While this can be useful for some simple HTML-like attributes, like disabled, this leads to hard-to-catch bugs.
Proposal: add a compiler define that forces boolean attributes to be required, just like any other ones.
For attributes like HTML's disabled, the developed can explicitly state
@:attribute var disabled:Boolean = @byDefault false;
Perhaps this could also be equivalent:
@:optional @:attribute var disabled:Boolean;
Multiple times we've run into issues when some boolean attribute is added to a view, then we forget to pass it, the code compiles, but the attribute is false by default. While this can be useful for some simple HTML-like attributes, like
disabled
, this leads to hard-to-catch bugs. Proposal: add a compiler define that forces boolean attributes to be required, just like any other ones. For attributes like HTML'sdisabled
, the developed can explicitly state@:attribute var disabled:Boolean = @byDefault false;
Perhaps this could also be equivalent:@:optional @:attribute var disabled:Boolean;