[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.



Andre van Tonder wrote:
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.

Yes. Fortunately it is not hard to see how.

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.

You are in luck - the R5RS forbids recursive syntax :-)

Apropos recursive syntax, I just *have* to mention Queinnec's
"Compiling Syntactically Recursive Programs",
<http://www-spi.lip6.fr/~queinnec/Papers/synrec.ps.gz>

--
Jens Axel Søgaard