This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: behavior of CASE with strings PART 2


On Jan 17, 2017, at 8:23 AM, Per Bothner <per@bothner.com> wrote:

> CASE *cannot* meaningfully be used with strings.

Indeed.  Meanwhile, this sort of categorization of strings can be
useful, as evidenced by the addition of String switches to Java 7.

The portable Scheme way to do this would be to use symbols instead of
strings, since ordinarily symbols are interned and thereby eqv?, but I
could see a place for Kawa-specific syntax that compiles to the
equivalent of a Java String switch block (which uses hash codes and a
lookupswitch to avoid doing every string comparison in a big if-else
chain).

I'm not sure what we would call the macro, though -- string-case makes
me think of uppercase vs lowercase.

--
Jamison Hope
The PTR Group
www.theptrgroup.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]