[ioke-dev] Re: case Combiners syntax

  • From: Ola Bini <ola.bini@gmail.com>
  • To: Felipe Rodrigues de Almeida <feliperod777@yahoo.com.br>
  • Cc: dev@ioke.kenai.com
  • Subject: [ioke-dev] Re: case Combiners syntax
  • Date: Wed, 04 Feb 2009 19:47:01 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=Y24uVA4vzzYHMXCaYxV+dQWcVp9xYoU2HMcpSxc71pEShhbHVd/r3kqn0DcPaucqJs o1r2QQS3rihkZpZ/thz75SbIjrKZkuQLVGZXGtOT/xPhKnYb1SnB2MA/VJowxxVOI2HO RHG8pIem+eiLvFe/TkqFeN6/odmElHpVCvIVI=

Felipe Rodrigues de Almeida wrote:
Hi all,

I was wondering if wouldn't be more readable if the combiners use the following syntax:

case(value,
  Text and #/o+/, "it's a text with several oos" println,
  5..10 or 15..20, "numberific" println,
  "oh no!" println)

instead of
case(value,
  and(Text, #/o+/), "it's a text with several oos" println,
  or(5..10, 15..20), "numberific" println,
  else, "oh no!" println)

Hi Felipe,

I did consider that, but the problem is that if you do it that way you suddenly need to have a VERY smart case-walker. Seeing as something like that would make it hard to do case-statements that contained values from variables, I decided to go with a very simple mechanism instead of something like this.

That said - can you detail how you would have it work?

Cheers

--
Ola Bini (http://olabini.com) Ioke creator (http://ioke.org)
JRuby Core Developer (http://jruby.org)
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
Practical JRuby on Rails (http://apress.com/book/view/9781590598818)

"Yields falsehood when quined" yields falsehood when quined.




[ioke-dev] case Combiners syntax

Felipe Rodrigues de Almeida 02/04/2009

[ioke-dev] Re: case Combiners syntax

Ola Bini 02/04/2009

[ioke-dev] Re: case Combiners syntax

Felipe Rodrigues de Almeida 02/04/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close