Saturday, April 11, 2009

Oz: Don't See it Yet? Tell Me More!

I've been playing with the programming language Oz lately. It has an interactive interface. Conceptually, it's a lot like the Python shell. However, when you "Browse" (i.e. output) values, it outputs them to a second window called the "Browser". I could never figure out why a separate window was needed until just the other day.

If you feed the following into the interactive interface, it'll block (i.e. it won't show anything):
declare A B C in
C=A+B
{Browse C}
However, if you feed it the following:
A=10
B=200
It'll display 210 in the browser. It knows that it can't display C until it figures out values for A and B.

Ok, that's kind of interesting, but it gets weirder! If you feed the following into the interactive interface, it'll show "D" in the browser:
declare D in
{Browse D}
Now, if you go back and actually bind D to a value:
D=10
It'll change the D to a 10 in the browser. Crazy!

2 comments:

Shannon -jj Behrens said...

I think I've seen Alice do this sort of thing too.

Anonymous said...

Seems kind of like a free-form spreadsheet. It knows the dependencies and knows to update the dependent expressions when an input changes.

You should have a peek at verilog or vhdl -- these are event driven modeling languages used in hardware design. This kind of thing is pervasive there.