Created
November 23, 2009 05:09
-
-
Save clarkgrubb/240889 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
bash-3.2$ io | |
Io 20090105 | |
Io> respond_to := method( o, m, retv := true; e := try( o m ); e catch(Exception, if( e error containsSeq(" does not respond to "), retv = false)); retv) | |
==> method(o, m, | |
retv := true; e := try(o m); e catch(Exception, if(e error containsSeq(" does not respond to "), retv = false)); retv | |
) | |
Io> O := Object clone | |
==> O_0x100441870: | |
type = "O" | |
Io> O hello := method( "hello" println ) | |
==> method( | |
"hello" println | |
) | |
Io> O hello | |
hello | |
==> hello | |
Io> respond_to(O, hello) | |
Exception: Object does not respond to 'hello' | |
--------- | |
Object hello Command Line 1 | |
Object respond_to Command Line 1 | |
Io> respond_to(O, goodbye) | |
Exception: Object does not respond to 'goodbye' | |
--------- | |
Object goodbye Command Line 1 | |
Object respond_to Command Line 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment