Open
Description
Often Smalltalk implementations would special-case control structures to simplify implementations.
Personally, I think this isn't great. Though, I haven't bothered implementing it correctly either.
It would be good to specify the semantics, or, at the very least, explicitly have an example, and tests to ensure that #ifTrue:
and similar are treated as pure messages, and any implementation optimization is not observable from the language itself.
See smarr/SOMpp#7 for further discussion.
@ltratt's example should work. I don't think there's any good justification for it not to work.
T = (
ifTrue: x = ( ^2 )
run = (
(self ifTrue: 3) println.
)
)