-
Notifications
You must be signed in to change notification settings - Fork 5
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
Code block on method #134
Comments
Hey, there's very much a reason for this, we don't interpret "returning" and "evaluating to" the same way as Rust does. int Test1() { return 1; }
// Draco:
// func test1(): int32 { return 1; }
int Test2() => 1;
// Draco:
// func test2(): int32 = 1; Essentially the So the reason for
Now it could be argued, that returning and evaluating the main function block to a value should be equivalent. Our reasoning when going against this, is that I hope this helps clearing it up or makes the design choice more reasonable, but I'm open to observations/opinions about this. |
Yes, that does make sense and thank you for the explanation. I personally prefer the more expression based way handling this especially since other areas treat blocks as expressions for example if expressions. The other reason would be since methods could be declared with the |
Hi, I was playing around with it a bit in the playground and had read through your spec.
I would have expected the code block following a function to be treated the same as in test4, or maybe there is a reason for that?
The text was updated successfully, but these errors were encountered: