[plt-scheme] Object system vs. closures

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 31 14:30:10 EDT 2008

At Mon, 31 Mar 2008 13:15:15 -0500, "Grant Rettke" wrote:
> On Tue, Mar 11, 2008 at 10:18 AM, Eli Barzilay <eli at barzilay.org> wrote:
> > On Mar 11, Grant Rettke wrote:
> >  > On Tue, Mar 11, 2008 at 9:17 AM, Matthias Felleisen
> >  > <matthias at ccs.neu.edu> wrote:
> >  > >  you should design your object system so that the closures are
> >  > >  hidden and disjoint from real closures.
> >  >
> >  > Roughly, how does one do that?
> >
> >  http://docs.plt-
> scheme.org/reference/procedures.html#(def~20(~23~25kernel~20prop~3aprocedure))
> 
> Interesting.
> 
> What drove this feature that structures could act as procedures? 

Some examples of how they're used:

 * Keyword-accepting "procedures", which act as normal procedures when
   you call them without keywords.

 * Procedures that have extra information attached, such as the
   implementation of the procedure body.

 * Compile-time bindings that provide nice error messages when they are
   mis-used in expression positions; that is, you want to bind a name
   to a macro transformer (for the error message) but also associate
   data to the name for cooperating with some other syntactic form.
   Match transformers and `require'/`provide' sub-forms work this way.

That last one may have been the most immediate motivation when I added
support for applicable structures, but I don't remember clearly.

Matthew



Posted on the users mailing list.