From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60716 invoked by alias); 18 Jan 2017 06:37:02 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 60706 invoked by uid 89); 18 Jan 2017 06:37:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Jan 2017 06:36:51 +0000 Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1cTjrU-0007ll-Gn; Wed, 18 Jan 2017 07:36:48 +0100 Received: from 76-9-64-11-rt-broadband-00.broadband.oakhurst.sti.net ([76.9.64.11] helo=localhost.localdomain) by mailfront11.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1cTjrG-0000PY-KO; Wed, 18 Jan 2017 07:36:34 +0100 Subject: Re: behavior of CASE with strings PART 2 To: Jamison Hope , kawa@sourceware.org References: <201701171107.25991.Damien.Mattei@unice.fr> From: Per Bothner Message-ID: Date: Wed, 18 Jan 2017 06:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q1/txt/msg00023.txt.bz2 On 01/17/2017 07:57 AM, Jamison Hope wrote: > On Jan 17, 2017, at 8:23 AM, Per Bothner 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/