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

Re: Opaque syntax objects

This page is part of the web mail archives of SRFI 72 from before July 7th, 2015. The new archives for SRFI 72 contain all messages, not just those from before July 7th, 2015.

On Sat, 13 Aug 2005, [ISO-8859-1] Jens Axel Søgaard wrote:

Andre van Tonder wrote:

As we know, subtyping can be thought of in terms of implicit coercions. The alternative is having explicit coercions as in PLT, the use of which quickly becomes tedious when expressing simple things like
     (apply append stx))

That particular example can be written very succintly with pattern matching:

Certainly.  But consider instead something like

   (apply lset-union literal-identifier=? syntax-list-of-syntax-lists)

where lset-union is from SRFI-1. Here you would be forced to do the conversions as above.

Even worse, say we have an s-expression library with a procedure

  (sexpr-map f x)

that applies f elementwise to non-pairs in x - maybe, to make it nontrivial, efficiently avoiding cycles. In order to reuse sexpr-map to an opaque syntax object, we would have no choice but to walk the whole object first to convert it to an s-expression, basically defeating the purpose of using sexp-map in the first place.