Skip to content

Instantly share code, notes, and snippets.

@clarkgrubb
Created November 23, 2009 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarkgrubb/240889 to your computer and use it in GitHub Desktop.
Save clarkgrubb/240889 to your computer and use it in GitHub Desktop.
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