SmallJS
SmallJS copied to clipboard
Compiler: Allow local variable declarations within block
Example
myMethod
[ :a1 :a2 |
| v | v := 1. self onValue: v ] value.
!
Pharo has this too. Its is especially useful when blocks are called async, that need the correct variable instance.
But... as a workaround you can just declare (extra) block arguments temp vars. Those are not passed to the block and initialized to JS undefined by default (not nil !).