[plt-scheme] PLT v 4.0 discussion - separating interfaces from implementation

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jun 5 08:27:46 EDT 2008

At Wed, 4 Jun 2008 18:22:41 -0700, "Mark Engelberg" wrote:
> Increasingly, programming is all about learning how to separate
> interfaces from implementation.
> 
> PLT 4.0 offers at least two standard mechanisms for doing this.
> 
> 1.  Class and object-based programming.  [...]
> 
> 2.  Units.  [...]
> 
> 3.  Interestingly, PLT 4.0 does give us a taste of what it would be
> like to have common interfaces for important categories of datatypes.
> Sequences and dictionaries are the most obvious examples (are there
> more that I didn't notice?)  I find it curious that rather than use
> either of the above mechanisms for achieving this goal, both are
> written in sort of an ad-hoc manner. [...]

Eli has implemented "generics", which turn the pattern behind the
dictionary abstraction into a syntactic form. We ran out of time
to get it into 4.0.

The functions for a sequence, meanwhile, go through a thunk, because
they need to generate an instance of the sequence. If we wanted to
squeeze that into the same sort of abstraction as dictionaries, I guess
we'd have the thunk return an "object" (in the sense that dictionary is
an object) that supplies the functions, instead of returning multiple
functions.

And that also points to "object" in the class sense. The implementation
of generics is based on the same core construct as the implementation
of the class system. For classes, though, there's a level of
indirection that allows inheritance and symbolic lookup of methods.

Maybe there's a smooth path between all these points...

> I think that arriving at a solid, consistent way of doing this would
> be a great goal to consider in future versions of PLT Scheme.

That's PL research in a nutshell. :)  Hopefully we'll continue to make
progress.


Matthew



Posted on the users mailing list.