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

Re: The power of Lists



On Sat, 20 Aug 2005, Michael Sperber wrote:

Andre van Tonder <andre@xxxxxxxxxxxxxxxxx> writes:

I think the cost is worth it.  It is a one-time burden on the implementor that
gives significant (in my experience) convenience to users in perpetuity.  The
cost is bounded but the savings over all user programs is potentially infinite.

The same could be said for the opposite direction :-)

...in the sense that the number of useful utilities for syntax objects is pretty much finite, and in the case of opaque objects can be provided once and for all, if I understand correctly.

For what it's worth, let me point out to those who may not be familiar with it that it is really easy to provide a fixed set of generic operations only at compile-time in e.g. MzScheme. Something like

(module compile-time mzscheme
  (provide (rename this:car car)
           (rename this:cdr cdr)
           ........)

  (define (this:car x)
    (if (pair? x)
        (car x)
        (syntax-case x ()
          ((h . t) (syntax h)))))

  ......
)

Then

  (require-for-syntax compile-time)

imports these operations only for compile time.

The problem with this is, of course, that this way only a fixed set of list operations will work. One way of accommodating this restriction in the SRFI would simply be to specify this set of operations (say those from R5RS that would make sense on syntax objects).

But if we are specifying a fixed set of operations, one might as well go in the opposite direction, as you point out, and specify them as e.g.

   syntax-car, syntax-cdr, ......

on opaque syntax objects.  So I guess I agree with you there.

Andre