[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cond bug?? (maybe... )
Quoting "Ji-Yong D. Chung":
> If I type
>
> (begin
> (define => #f)
> (cond (#t => 'ok)))
>
> I get an invalid procedure error,
> which is not what I expected.
>
> Is this a bug?
No. `=>' loses its special meaning for `cond' only when it's lexically
shadowed. Top-level redefinitions of `=>' do not affect `cond'.
There is little agreement among implementations on the effect of
defining `=>', but MzScheme imitates Chez in this respect.
> wouldn't users expect
> consistency in behavior
> whether they are evaluating things
> at the top
> level environment or not?
Well, the top level is inconsistent with the rest of Scheme in a number
of ways. I think the choize Chez and MzScheme make is the more useful,
since code that defines `=>' won't break uncompiled library code.
On a related note, you may have noticed that our new module system
defines away the inconsistency (in principle): the top level consists
of module declarations, only.
(Of course, MzScheme will continue to support the top level in
practice, as a convenience and as a concession to plain Scheme.)
Matthew