You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java SOM prints "instance of Block1". There's nothing wrong with that per se, but it wasn't what I was expecting because a) (at least as far as I know) blocks can't get access to their instances under normal circumstances b) methods return self unless otherwise specified. I wondered if this was intentional or not? I couldn't find any obvious clues in Java SOM's source to indicate anything either way.
The text was updated successfully, but these errors were encountered:
The answer should really be nil, following all other Smalltalks I tested.
Blocks return the value of their last expression. Since there was no expression, there's no value.
At least that would be my interpretation of what the other Smalltalks do (GNU Smalltalk, Amber Smalltalk, Squeak 2, 5, and Pharo).
128: Empty blocks evaluate to nil. r=ptersilie a=ltratt
Whilst here, it is silly for `add_global` to take a `String` when both callers have to call `to_owned` for the `&str` they really have.
Note this is different behaviour from (at least) Java SOM (see SOM-st/SOM#36).
Co-authored-by: Laurence Tratt <[email protected]>
What should this program print?
Java SOM prints "instance of Block1". There's nothing wrong with that per se, but it wasn't what I was expecting because a) (at least as far as I know) blocks can't get access to their instances under normal circumstances b) methods return
self
unless otherwise specified. I wondered if this was intentional or not? I couldn't find any obvious clues in Java SOM's source to indicate anything either way.The text was updated successfully, but these errors were encountered: