-
Notifications
You must be signed in to change notification settings - Fork 30
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
Setters should return their argument #54
Comments
While the other issue is being discussed (adding the API) would you like to go ahead and make a PR for this? It seems the agreement was reached that this is the correct behavior at least. :-) |
Interesting point of view. As we usually do not really "use" setters, but what other languages call "property access". hence we have the idea from C etc. that: In my opinion the compiler should take care on the level of that expression that this is the case. And there is no reason that the setter is returning its argument. In fact the setter should return "this". And that also should be the responsibility of the compiler. So you can write: Albeit, while I'm typing this: I wonder if you can call a setter in wren, or if a setter can only be accessed via "="? |
In Wren, assignment returns its value, like in C:
When implementing setters, we need to maintain this behavior:
Generally, the CLI do that, except in one foreign setter -
Stdin.isRaw=(_)
:wren-cli/src/module/io.c
Lines 509 to 525 in b82cf5a
Instead we should do:
The text was updated successfully, but these errors were encountered: