From: Matthias Veit Date: 2002-06-18T04:10:01+09:00 Subject: case and classes Hi, today I wrote a method in my youthful levity and was wondering about raised exceptions. The method was similar to: def do_class_sensitive(classhandle) case classhandle when Array #do somethiong... when String #do somethiong... when Fixnum #do somethiong... else raise "what to do with #{classhandle.name}??" end end The aim was to write a class sensitive switch - but this does not work. I could use the classname (the string) to make the switch work, but this was not the intention. I could imagine, that inheritance is the academic problem of the case-switch: falls a subclass of Array into the Array-clause or into the else-clause? (if the specific subclass is not listed in the switch). So I want to ask: what is the expected behaviour of a class sensitive switch?? Best regards, Matthias _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com