On Sun, 5 Aug 2001, Dave Thomas wrote: > If you want to do type testing, you should really use #respond_to?, > not #is_a?, as that way you'll make explicit the operations that > you're asking your object to have. No, you'll make explicit the names of the operations, which is quite close, but quite not. You can say this method only requires #[] but it's not specified whether it's Array#[] or Hash#[], or the VerySpecialThing#[] (whose semantics are not written down anywhere), then knowing you need #[] only tells you half of what you need to know. > Again, though, I'd question the usefulness of this. What is the > benefit of having an application die with an assertion failure at the > top of a routine, when it will fail anyway with a NameError a few > lines down? Because a few lines down it may be too late. Well, maybe not, there's these UndoableArray/UndoableString/UndoableHash classes I wrote, so you'd use them and wrap their operations within #modify{} blocks to ensure some atomicity, but it still only works for one structure at a time, not several. (MetaRuby 0.7 is supposed to have a better Undo system, but that's still vapourware.) matju