From: Hal Fulton Date: 2006-03-23T15:06:55+09:00 Subject: Re: what on earth.. Timothy Bennett wrote: > > On Mar 22, 2006, at 8:22 PM, Caleb Clausen wrote: > >> >> For the cases you give, it seems pretty straightforward, but what >> about this: >> >> Fixnum===Class #false >> Class===Fixnum #true >> >> Should Class be considered a Fixnum just because Fixnum is a Class? >> > > Hm, at least that makes sense. However, it's hard for me to think of > === as having direction (it doesn't look like it has direction, and > therefore it can be difficult to remember which direction it's supposed > to go sometimes). I drew some (a little) criticism for spending four pages in _The Ruby Way_ covering the case statement. I think it's powerful, and I think it's done the Right Way, and shouldn't be changed. But I also think there are some non-obvious quirks (such as you describe). It also bears remembering that === is not called on the item being tested, but on each of the items tested against. So case x when a do_something end means if a === x do_something end HTH, Hal