« parsing and scoping for 0.37 | Main | Goals for release 0.38 »

March 27, 2005

Release 0.37 (Dove)

Contex 'Dove' is released, with a speed-tuned variable binding system that supplies the developer with dynamic scoping in addition to verbose parsing errors.

I planned on getting more done in the beginning, but I hadn't realized how much trouble dynamic scoping was going to be. Now, there is a major change regarding how 'inp' works, which will remind people of CBN (call by name), a feature that makes some people ball a fist. The 'CBN' found in CX is completely optional and would only be done intentionally:

(cx:) make["eval" ${inp}]
(cx:) eval @{print-line "hello"}
hello

Wowsers- that's the official definition of eval! any quote you send to eval must be live. It can be live scoped or unscoped. See,

When a variable is used and it points to a dead quote, the quote is just referred to.
When a variable is used and it points to a live quote, the quote is run. There are two types of 'live' quotes: scoped and unscoped.

{ blah } (<- that is a dead quote)
@{ blah } (<-- that is a live quote. it is scoped)
${ blah } (<-- that is a live unscoped quote)

Ok, so looking back at that definition of eval, the quote used to define it was unscoped. This means that when we say 'eval', it is JUST like we typed out the definition, except inp is a variable that points to the input to eval:

(cx:)eval 43 (is just like typing:)
43

so, let's use it the right way:

(cx:) set["x" {set["x" 4] print-line "set x to 4" }]
(cx:) eval x
{ set [ "x" 4 ] print-line "set x to 4" }
(now, the 'inp' found in the definition of eval executes the unscoped quote: )
(cx:) eval $ x
set x to 4
(cx:) x
4

Anyway, you can read the last entry to see the details on cx's dynamic scoping and parsing errors. This inp thing is all that has changed since then.

Now it's time for me to write a cheat sheet for anyone wanting to take a fast attempt at CX. I'll do it in tex and add a 'docs' section to the top of this site when I'm ready with the different formats of this cheat sheet.

Posted by Rex at March 27, 2005 05:46 PM

Comments

Post a comment




Remember Me?