3 ms·
>Squeak kinda does, as it doesn't allow for locals within blocks. All Smalltalks allow this by putting the variable names in a pair of "|" after the "[" starti
by squeakthrowawy 10y ago
>Squeak kinda does, as it doesn't allow for locals within blocks.
All Smalltalks allow this by putting the variable names in a pair of "|" after the "[" starting a zero-arg block or the "|" terminating its argument names:
[| localVar | ...]
[:firstArg | | firstLocalVar | ...]
[:firstArg :secondArg | | firstLocalVar secondLocalVar | ...]
> Basically a variable is either shared or local. Locals were usually unimplemented or poorly implemented in the past.
Traditionally block argument and block local vars shared the same "temp frame" with the method they were defined in, meaning that while indeed local, they were only local to their method, not the block itself. But Squeak, Pharo, Gemstone, VW, all have compilers and VMs that support real closures, where each block introduces a new scope and blocks can be written to evaluate recursively.