Wednesday, September 16, 2009

Blocks in Smalltalk can have their own temporary variables

Did you know that the following appears to be Smalltalk code? Runs fine in the current Pharo.

[:a | |b| 2] value: 3


  1. Yes, of course they can (even though Pharo ignores the nesting and turns them into top-level temp vars, lulz)

  2. This comment has been removed by the author.

  3. That will be fixed in the NewCompiler along with all other problems of mankind :)

  4. akuhn, it's not that easy. to begin with, in a printit they behave differently than in a method. In a method they very much behave. In a printIt, they can sort of escape their context.


Note: Only a member of this blog may post a comment.