[Grace-core] Fwd: Some notes on pattern matching on the wiki

James Noble kjx at ecs.vuw.ac.nz
Tue Jul 5 05:47:23 PDT 2011


> It really is rather tortured.   I don't buy it for Grace, much as I respect both Ungar and Bracha.

I don't think I ever really bought it for Self.

> Here is my point of view.
> 
> The idea of lexical binding is rather an important one in Programming Languages.  It's something that students should meet, and they should meet it early on.  Since we are OO bigots, we also believe that they should meet dynamic binding early on.  So Grace should provide a vehicle for teaching both.

Yep, I can see that.

> Is if better to teach them as two different concepts, or to try to explain lexical binding as a tortured version of dynamic dispatch?  Even if one succeeds in doing the latter, how does that understanding of lexical binding carry over to another language, like Algol 60 or ML?

It's actually the other way around: the Scheme/Beta/Simula model of classes as closures over procedures, perhaps with "prefixing" -
would say you should treat everything belonging to yourself as if it were lexically bound, and only use dot-notation for sends
if you're sending to another object.

So the result would look much like Self code in practice - basically no explicit self sends; self only used to get the value - 
but the conceptual model would be quite different: everything inside this object isn't a send, it's just a lexical lookup
(tweaked for inheritance perhaps). 

It's probably (partly) important here that Simula & Beta use "inner" calls on methods,
rather than Smalltalk-derived "self" sends (that dynamically dispatch down to "subclass implementations"
and super calls...

James


More information about the Grace-core mailing list