public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Jamison Hope <jrh@theptrgroup.com>, kawa@sourceware.org
Subject: Re: behavior of CASE with strings PART 2
Date: Wed, 18 Jan 2017 06:37:00 -0000	[thread overview]
Message-ID: <e778b9c7-fe7a-1d1a-7c73-8723906e2454@bothner.com> (raw)
In-Reply-To: <AEE215CF-B72C-42D3-96AA-634C2D435139@theptrgroup.com>



On 01/17/2017 07:57 AM, Jamison Hope wrote:
> 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.

I guess we could add it as a Kawa "extension", but it would explicitly
violate r5rs/r7rs.

> 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 think this is something to think of for the Kawa 3.0 release,
using the new PATTERN construct in each clause.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

  reply	other threads:[~2017-01-18  6:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 10:07 Damien MATTEI
2017-01-17 13:24 ` Per Bothner
2017-01-17 15:57   ` Jamison Hope
2017-01-18  6:37     ` Per Bothner [this message]
2017-01-19  4:53       ` Per Bothner
2017-01-19 10:04         ` Damien MATTEI
2017-01-19 16:00           ` Per Bothner
2017-01-21  9:47         ` Damien Mattei
2017-01-22  4:36           ` match form as a generalization of case Per Bothner
2017-01-23 22:12             ` Damien Mattei
2017-01-23 22:27               ` Per Bothner
2017-01-20 22:54 behavior of CASE with strings PART 2 Damien Mattei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e778b9c7-fe7a-1d1a-7c73-8723906e2454@bothner.com \
    --to=per@bothner.com \
    --cc=jrh@theptrgroup.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).