Created
August 3, 2010 14:33
-
-
Save vito/506471 to your computer and use it in GitHub Desktop.
Block@in-scope
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(b: Block) in-scope := | |
Object clone do: { | |
delegates-to: b | |
call := b scope do: b | |
call: vs := b scope do: b with: vs | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the $ the | |
> x = 0 | |
> [1, 2, 3] map: { n | x = x + n; x } in-scope | |
[1, 3, 6] | |
> x | |
6 | |
> { 1 + 1 } in-scope contents -- delegates to the original, so this still works | |
[(1 + 1)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment