Created
January 26, 2009 01:39
-
-
Save anekos/52651 to your computer and use it in GitHub Desktop.
関数呼び出し元のローカル変数を参照&変更する
This file contains 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
Foo := Object clone | |
Foo bar := method( | |
# 呼び出し元の値を参照 | |
call sender v println | |
# 呼び出し元の値を書き換え! | |
call sender v = "new value" | |
) | |
Object clone do( | |
v := "local value" | |
Foo bar #=> local value | |
v println #=> new value | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment