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). And neither do implementors, in my experience. > > > Not necessarily so. One can consider a (case) pattern to be implicitly > > quasiquoted (just like traditional case is implicitly quoted). So, if > > one needs "extended" (case) capabilities, one would write: > > > > (case 'b > > ((,a) (list a))) > > Quoting, alas, is incompatible with quasiquoting. (,a) is just syntax > sugar for ((unquote a)), which is a perfectly legitimate argument for > a case arm that matches on a list eqv? to it. Somewhat unlikely that > you will find such a list, but that's still what it means. I have no quoting in my example clauses. Read it as follows: (case 'b ((`,a) (list a))) ; explicate quasiquote BTW, multi-clause case would be: (case 'b ((`x `y `,a) (list 'foo))) ; no a in body due to disjunction or if you prefer (still matching either 'x, 'y or anything): (case 'b (`(x y ,a) (list 'foo))) ; still no a Obviously, one can elide explicit quasiquotes around each alternative, giving back the degenerate semantics of (case). Oleg's matcher does this also, but for a different reason (to delineate pattern variables). > > > From my perspective, (case) is a degenerate case of (match) and should > > be merged - we don't need two switch constructs in a simple and small > > language. > > Note that this is a WG2 proposal, ergo not the "simple and small language". > I hope this WG shall not try make it more complex and large that it needs to be. Pjotr _______________________________________________ Scheme-reports mailing list Scheme-reports@scheme-reports.org http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports