-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you treat the statement as an expression, I do not think you need a do-expressions #11
Comments
I also keep thinking about this. What if we would change language semantics to make various statements (if, switch etc.) expressions instead. I keep wondering if there is a way that this is not backward compatible but as long as we don't try to infer return at the end of the functions (rust style) it should be fine. What do you think? @dherman Is it discussed somewhere already? |
This is how Rust works (the first example is a valid Rust syntax!), and I love it. There are no statements. Everything is an expression. Constructs that don't have anything sensible to return (e.g. |
Seems related to #9 |
There are two big complications to be aware of:
Not that I'm against this idea (I'm actually vehemently in favor of it), but there are things to look out for, and the naïve way of doing it won't work as you would expect. One way to resolve this ambiguity is by disallowing Also, doing this (making most statements expressions) would simplify the grammar and literally every parser out there, because they can check 99% of statements and expressions at the same time, only branching for very specific cases like in the case of object literals and
(Note: this idea should be backwards-compatible, despite the significant change.) |
I'm going to close this in favor of #39, which is the same proposal but has more discussion. Please see my most recent comment there, in particular. |
This one can be written more simply.
This is a README sample code.
The text was updated successfully, but these errors were encountered: