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

Re: [Scheme-reports] ANN: first draft of R7RS small language available

15 minutes ago, Vitaly Magerya wrote:
> Folks, why do we at all match keywords (e.g. "else") lexically instead
> of textually?

Because hygiene means that scheme syntax has identifiers as something
that is conceptually separate from symbols, and that tends to roll on
to other decisions.

> The ability to rename keyword on export is one stated benefit, but I'm
> not sure this was/will ever be used.

It has been used.

Another related reason is the ability to avoid having a binding for
`else', without re-binding it just for that purpose.  (See Andre's
original post for several more.)

> Moreover many implementations have keyword and optional arguments,
> and I never heard anyone complaining that you can't rename them.

If these keywords were implemented as identifiers (and traditionally
they're not), then it would make sense to do it there too.

> Simplicity of syntax-rules is another benefit: now we've got one
> list of identifiers that are matched lexically, we'd need one extra
> list for those matched textually.

Right.  At least in Racket there is a `syntax-case*' that takes an
extra argument that is the function to identify keywords.

> There are also historical reasons, i.e. it worked fine in R5RS where no
> modules existed (provided you don't shadow "else" locally).

Right -- and that fact (the fact that `else' can be shadowed by a
local binding) is a fundamental motivation.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Scheme-reports mailing list