From: Christian Neukirchen Date: 2005-04-29T02:14:05+09:00 Subject: Re: Announcing Reg 0.4.0 Ilmari Heikkinen writes: > On 26.4.2005, at 20:35, Christian Neukirchen wrote: > >> It is already very confusing that String !=== String (what is the most >> elegant way to case compare classes against classes, btw?). > > I don't know about elegant, but this is probably the way that requires > least typing: > > def make_new(klass) > case [klass] > when [String]: "foo" > when [Fixnum]: 27 > when [Array]: [nil, nil, true] > end > end > > make_new String > => "foo" Nice, that conses a lot but is readable and understandable. Thanks! > Ilmari Heikkinen -- Christian Neukirchen http://chneukirchen.org