-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
proposal syntax else ... then for else keyword in conditional branches #207
Comments
Without heavy justification in an RFC, I would be against this proposal. I would advise anyone writing an RFC for this to spend a good deal of time explaining why this is better than what currently exists as this adds nothing semantically that isn't already in the language. |
What's the value/improvement that this would bring? |
Removing a keyword |
While simple is better, I don't know that everyone would agree that removing the keyword |
I am not in favour of this change; I think that |
Even if we were to agree it is both simpler and better in absolute terms, it needs to provide enough value to justify overcoming the friction of a widely-breaking change. If the value it provides is marginal or just notional, but not significant in the sense of providing meaningful/substantial value to users of Pony, then it's not worth the breaking change. |
Dropping in to say I am also not in favor of this. Also here to add that |
@SeanTAllen also mentioned in today's sync that the parser is currently written to require no lookahead, and this would potentially break that current invariant. |
@jasoncarr0 also mentioned that human parsers also have the same problem with lookahead 😉 |
Though not clearly documented in the tutorial, one can simulate this syntax with pattern matching using guards, like: actor Main
new create(env: Env) =>
let x: USize = 123
match x
| if x < 50 => env.out.print("< 50")
| if x < 100 => env.out.print("< 100")
| if x < 200 => env.out.print("< 200")
else env.out.print("= 100")
end |
examples in tutorial
limited by set pattern in old school
just use "else ... then" instead of "elseif ... then"
And it is ok in expressions
And there is almost no additional cost for parsing.
The text was updated successfully, but these errors were encountered: