On Wed, Sep 9, 2009 at 4:25 PM, John Cowan <[email protected]> wrote:
> Sam TH scripsit:
>
>> This proposal seems like it would benefit from looking at what PLT has
>> done with readtables and extensible lexical syntax.  In particular,
>> Matthew Flatt's ICFP '09 paper [1], Eli Barzilay's Scheme Workshop '09
>> paper [2], and the documentation [3].
>
> The two papers are interesting demonstrations of what can be done with
> fully redefinable syntax (similar results were achieved in SGML, making
> it possible to read Lisp programs as SGML documents), but don't explain
> any of the mechanism.

The papers demonstrate, convincingly to me, that this conclusion is wrong:

> Arbitrarily mutable lexical syntax, however, means that people trying to
> read Scheme code may not even be able to *recognize* it as such: such
> basic features as (...) can be defined away or redefined.  This may be
> useful when constructing lexers at run time, but that doesn't have to
> be done through "read".

Scribble would be vastly less useful if it wasn't used via `read'.

> The documentation at 12.9 that you point to is
> very obscure, but by poking around I eventually found what appears to
> be the essence of #lang in this sentence from 12.6.13:
>
>        When the reader encounters #reader (of which #lang is a close
>        variant), it loads an external reader procedure and applies it
>        to the current input stream.
>
> This is equivalent to executing arbitrary Scheme code in the context
> of the compiler.  PLT Scheme has to be able to do this anyhow because
> it has low-level macros, but nothing in R5RS or small Scheme as I have
> so far proposed it requires this capability.  To make explicit what PLT
> leaves implicit here requires precisely "eval-when", which is always a
> dangerous thing because in all standards the environment of the compiler
> is underspecified.
>
> My design is sharply limited precisely to prevent this necessity (which I
> refer to as "the phasing problem") and to make small Scheme compilation
> an entirely static process.  I have, of course, nothing against
> implementations that *do* allow such dynamic behavior in their compilers.

It would seem like a mistake to apply arbitrary restrictions to a
useful feature, especially since small Scheme is supposed to be
compatible with large Scheme, were this problem will presumably have
to be tackled.

-- 
sam th
[email protected]

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to