Created
August 8, 2010 01:29
-
-
Save vito/513433 to your computer and use it in GitHub Desktop.
dispatch object + pseudo lisp-style parameterization
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 | |
> foo := dispatch sender x | |
> foo | |
message not understood: (<reference> x) | |
> x = 0 | |
> foo | |
0 | |
> { x = 42; foo } call | |
42 | |
> x | |
0 | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should let me do some neat Scheme-style stuff like:
The idea being,
write
by default outputs to the terminal, but it's really determined by somecurrent-output-port
slot. Combined with lexical scoping via blocks, and thedispatch
form which gives access to the sender's scope, we can safely "override" that value just for that scope.Also: yes, this is pretty much directly from Io - in fact almost all of their
Call
objects' slots have a direct correlation to something in The as well. Neat. (The odd one out beingcall target
- in The a dispatch may have many targets.)