public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Damien Mattei <damien.mattei@gmail.com>,
	Bent Phillipsen <bent.phillipsen@gmail.com>
Cc: Kawa mailing list <kawa@sourceware.org>, bigloo@sophia.inria.fr
Subject: Re: [bigloo] behavior of CASE with strings
Date: Sat, 21 Jan 2017 16:55:00 -0000	[thread overview]
Message-ID: <542a6bc4-5295-b71d-0bf3-4d054895169f@bothner.com> (raw)
In-Reply-To: <CADEOadf+++LDz8srLL2p3Vh6hgpjMiqF2-g1-O2_7K9bp1eGEw@mail.gmail.com>

On Tue, Jan 17, 2017 at 8:27 PM, Bent Phillipsen <bent.phillipsen@gmail.com> wrote:
> This has the consequence that stings cannot be used as key and clause in
> case expressions in a well defined way (or at least portable way). You can
> however easily define a macro that *also* can use strings. You can write
> your own; but simply taking the case macro defined in R5RS (p.43) ensures
> that all corner cases are handled correctly. You then just need to replace
> 'memv' with 'member' (this has the effect of testing equivalence with equal?
> instead of eqv?). You probably want to change the name of the macro also,
> for instance to case-member, to avoid shadowing the original case
> expression. You will get something like the following, which should work and
> which I think is portable. (There is of cause a (mostly insignificant)
> performance penalty in testing with equal? instead of eqv?):

In Kawa 'case' is optimized, so the performance penalty of re-implementing
case "by hand" would be more significant.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

      reply	other threads:[~2017-01-21 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201701121129.54147.Damien.Mattei@unice.fr>
2017-01-16 13:34 ` Manuel.Serrano
     [not found]   ` <CAD1yAURxqeVTmpbktQr-+F6hKZUySg6zQbRzjB224=wTvfNa-w@mail.gmail.com>
2017-01-21 10:07     ` Damien Mattei
2017-01-21 16:55       ` Per Bothner [this message]

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=542a6bc4-5295-b71d-0bf3-4d054895169f@bothner.com \
    --to=per@bothner.com \
    --cc=bent.phillipsen@gmail.com \
    --cc=bigloo@sophia.inria.fr \
    --cc=damien.mattei@gmail.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).