From: Guoliang Cao Date: 2004-02-05T04:07:06+09:00 Subject: Re: RCR draft for enhanced "case..when..else..end" syntax ---- Original Message ---- > On Wed, 4 Feb 2004 12:55:42 -0500, Guoliang Cao wrote: >>> better yet with a lookup table. This sort of problem is handled easily >>> by intelligent data-driven design. >> Don't mix system design with language capabilities please. > I'm not. This proposal does. What you're wanting to do is effectively make > it so that case operates in parallel on multiple conditions. I can count on > zero hands the number of times that I've needed this capability. I have When you are thinking it's not something you'll need, the count is always zero. > found it more useful to worry about my data design and make sure that I > have a proper lookup table. Robert's design does exactly that with multiple > custom objects instead of a lookup table. >> I think it's not a bad thing to let "case" to take more than one >> expressions. Just like a function can take any number of arguments. Why >> does "case" have to be limited to zero or one? Because all our languages >> are designed this way? (AFAIK only Ruby "case" can take 0 expressions. >> That's some good stuff introduced by Ruby, right? So why not go one step >> further?) Or because it's impossible? > Nothing is impossible. It's a question as to whether it's a good idea. > Frankly, your proposal is a bad idea. I said as much to your initial posting > on RubyGarden. It might be. I can accept that. ;-) >>> There is no need for a new or modified language construct here. >> Since 2.0 is a major update to 1.x, why can't we introduce new language >> constructs if they really makes sense? > Except that your construct doesn't make sense. > 1. It introduces unnecessary complexity. I can't see how complex it is. It might be though. I might have mixed too many things in one proposal. > 2. It adds a lot of "magic" that isn't clear (_ or ~ -- both are really > ugly). Ruby2 seems to be getting rid of a lot of that silly magic. Once it's clear, it's clear. > 3. It adds a language "feature" that is better handled by proper program > design. About my example, I don't think people should do a complex design. "if..elsif" is the answer in current Ruby capability. Cao > -austin > -- > austin ziegler * austin@halostatue.ca * Toronto, ON, Canada > software designer * pragmatic programmer * 2004.02.04 > * 13.31.26