[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [r6rs-discuss] [Scheme-reports] Scheme pattern matching: the case for (case)
Yesterday, Peter Kourzanov wrote:
> On Tue, 2010-12-21 at 15:30 -0500, John Cowan wrote:
> > > eqv? is immaterial here:
> > >
> > > (let ([eqv? equal?]) (case "asd" (("asd") #t)))
> > That does not mean what you think it means, for two reasons. One
> > is that with a proper hygienic macro system, rebinding eqv? does
> > not affect any uses of eqv? in the expansion of the case macro.
> > The second reason is that implementations are free to make literal
> > strings eqv? if they have the same content.
> Right. However, this still is an underspecified corner of Scheme.
> Even in R6RS I don't see a mandate to always implement (case) via
> hygienic macros (and have the system solve the rebinding).
Neither r5rs nor r5rs require `case' to be implemented as a macro in
the first place -- so the specification that it should not be
"confused" by a lexical scope with a different definition for `eqv?'
is implicit in that the form is required to actually work. And if
this is advocating such a specification, then why should there be one?
There shouldn't be any difference between an implementation that
implements it as a macro and one that does so as a core form, as long
as it works.
> And neither do implementors, in my experience.
Is there really any implementation where
(let ((eqv? #f)) (case 1 ((1) 1)))
throws an error? (I don't know of any, but if there is one, it should
be a case for a bug report rather than something to draw conclusions
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
r6rs-discuss mailing list