[Prev][Next][Index][Thread]

Re: abstraction power




Yeap, I apologized to Jon for my misinterpretation of his claim. 

And: I used "newfangled Scheme facilities" because I believe that 
the old claims about faking data abstraction with procedures are
less than satisfactory from a practical and an expressivity kind 
of view. To be concrete: if you use define-struct (and units, 
which aren't necessary), you can signal reasonable error messages 
when someone misuses your counter (bad operation). With just lambda, 
you can't. More precisely, you cannot determine whether some lambda
represents a plain old closure or a counter -- unless you translate 
the _entire_ program into a closure-are-data-abstraction style (as
in cps). 

The generativity of define-struct is necessary because you need to 
be able to introduce as many classes of data as you wish. Because 
everything happens at run-time, you get run-time generativity. [This
aspect can be achieved with plain old lambda encoding in Scheme, because 
the report explicitly specifies that eq? works on procedures.]

Hope this helps -- Matthias