[plt-scheme] v4 questions

From: Noel Welsh (noelwelsh at gmail.com)
Date: Mon Mar 31 12:22:49 EDT 2008

On Mon, Mar 31, 2008 at 5:09 PM, Grant Rettke <grettke at acm.org> wrote:
> On Sun, Mar 30, 2008 at 9:00 PM, Mark Engelberg
>  <mark.engelberg at gmail.com> wrote:
>
>  >  In my ideal programming world, up at the top of a given module, I
>  >  could specify what I want my default data structure to be, e.g.,
>  >  #lang scheme
>  >  #list basic-list
>  >
>  >  Then, when I'm done with my module, I can easily test and time the
>  >  code using various data structures that make different tradeoffs:
>
>  A question came up about structures on comp.lang.lisp the other day.
>
>  One of the proposed approached to abstract away the difference in
>  working with classes versus structures was to use macros:
>
>  http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/ec1782e569f04de0?hl=en
>
>  Would macros be a good way to abstract away the changes you need to
>  manage to switch between the different data structures in this case?

The basic issue is one of defining an interface (say, car, cdr, cons)
and then allowing the programmer to change the implementation of that
interface.

Units are one way to tackle this, but they are cumbersome to use.

Objects are another, though the default object system doesn't fit the
bill unless code is written for it from the start (as you have to
sprinkle send all over your code).

I've recently become aware that structure properties are used to
implement type-based dispatch in many parts of PLT Scheme.  So if I
was to address this problem I'd probably implement a generic function
based OO system using structure properties.  I think this is a simpler
and neater solution than using macros.

N.


Posted on the users mailing list.