MVCoconut / coconut.ui

Wow, such reactive view! Much awesome!
The Unlicense
89 stars 9 forks source link

Add a compiler define for forcing boolean attributes to be required #97

Open gene-pavlovsky opened 1 year ago

gene-pavlovsky commented 1 year ago

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;