Re: Lexical syntax for boxes John Cowan 22 May 2013 15:12 UTC

Alex Shinn scripsit:

> Well, WG2 has to deal with phasing anyway.  One possibility would
> be to make define-reader-ctor a library declaration.

That's a very interesting idea, particularly if we require that it appear
before any use of the new syntax.

> SRFI-108 is pretty huge and scares me somewhat.  Maybe it's good,
> but really for just read/write of records there are much simpler solutions
> that will be easier to gain traction.

I think the core is pretty simple.  For objects you want to initialize
from a literal string, you write:

    &name{string}

which is lexed as

    ($construct$:name "string")

If you want expressions instead, you write:

    &name[expr expr expr]

which is lexed as

    ($construct$:name $<< expr expr expr $>>$)

where $<<$ and $>>$ are variables defined by the implementation as
distinct objects, typically empty strings.

You can also have both [] and {}, and you can write &[expr ...] inside
braces to get unquoting.  Everything else is just bells and whistles.

The main thing is that there is no separate registry of names.  You just
define procedures or syntax forms with the appropriate names, and the
Right Thing happens.  As long as you abstain from using names of the form
$construct:* randomly in your code, you have the same security as SRFI
10 with no phasing issue.

--
My confusion is rapidly waxing          John Cowan
For XML Schema's too taxing:            xxxxxx@ccil.org
    I'd use DTDs                        http://www.ccil.org/~cowan
    If they had local trees --
I think I best switch to RELAX NG.