[racket] Case with strings: normal behavior?

From: David T. Pierson (dtp at mindstory.com)
Date: Tue Nov 20 01:14:18 EST 2012

On Mon, Nov 19, 2012 at 06:13:09AM -0700, Matthew Flatt wrote:
> Should we change `case' to use `equal?' instead of `eqv?'? I can't
> think of a good reason to stick with `eqv?'.

My first reaction to this was that such a change would eliminate one of
the motivations for using `case': getting the (perhaps insignificant?)
performance improvement of using `eqv?' in a conditional when you know
the key type is suitable for it.

However it occurs to me that since the datums in a `case' clause are
always literals, couldn't the expansion of `case' be "smart" enough to
use the appropriate comparison function (eq?/eqv?/equal?) given the type
of the datum?

David

Posted on the users mailing list.