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

Re: Lexical syntax for boxes

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

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:


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:            cowan@xxxxxxxx
    I'd use DTDs                        http://www.ccil.org/~cowan
    If they had local trees --
I think I best switch to RELAX NG.