chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] warn if binding to keyword


From: Thomas Bushnell, BSG
Subject: Re: [Chicken-hackers] [PATCH] warn if binding to keyword
Date: Tue, 25 Oct 2011 12:00:03 -0700

On Tue, Oct 25, 2011 at 7:30 AM, John Cowan <address@hidden> wrote:
Thomas Bushnell, BSG scripsit:

> In the context, it's been bound.  If ,%: returns the keyword instead
> of the value of the local variable, it's a bug.

It's not clear to me that binding keywords ought to be allowed at all.
What benefit does that provide?  Normally, we rely on keywords being
self-evaluating.

Normally we rely on IF to be a special-form too. But Scheme does the Right Thing by letting you bind any name you want, and treating all names as the same.

The instinct here comes from the fact that keywords look like syntax, but really are just self-evaluating symbols, and so suddenly people want them to behave like syntax. But even then, note that syntax in Scheme is also constructed from identifiers which can be rebound if you like.

(let ((lambda ...)) ...)
(let ((foo: ...)) ...)
(let ((=> ...)) (cond ...))

should all work.

And, since the binding is lexically apparent, there isn't any need for special warnings.

In the case Felix identified, if the binding doesn't shadow the top-level self-evaluating bit, then that's a bug, not call for a warning.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]