forked from jckarter/clay
-
Notifications
You must be signed in to change notification settings - Fork 0
Miscellaneous syntax improvements
jckarter edited this page Nov 23, 2010
·
6 revisions
Random ideas for syntax improvements:
- Make the final ";" in an statement list optional, similar to the optional final "," in an expression list:
{ foo() }{ foo(); bar() }
- Make
{ }indicate a nullary statement lambda, implying the() =>:each(bar, { bas() });- This would cause an ambiguity in the parsing of if statements and expressions:
if (x) { y() } else { z() }- However, since an if expression returning lambdas is currently not valid (the two lambdas are of different incompatible types) the ambiguity could always be resolved in favor of the statement form. The ambiguity is still a bad trap
- Make the parens around
if,while,forandswitchoptional:if x { y() } else { z() }for x in y { z() }while x { y() }switch x { case y: z() }- Looks a bit awkward in the single-statement case, especially with infix expressions:
if x y();while x == y z += w;