On Friday 04 June 2004 21:43, Ara.T.Howard wrote: > On Sat, 5 Jun 2004, Sean O'Dell wrote: > > I need to detect when an object is a hash-like container for other > > objects, one which responds to [] and which can index using any object as > > a value (string, etc.). > > create a module that is a ducktype 'flag' for hashables > > module HashingObject; end > > add it to hash - a bit ugly, but does nothing > > class Hash; include HashingObject; end > > bless any class you deem good anough with the module Funny, this is similar to an idea I had once about flagging objects as implementing certain kinds of interfaces. I think this will actually do the trick for me nicely. I'll just pre-tag all the objects I need to id and then go from there. Too bad something like this isn't built-in; it would be nice to get an automatic error when the object type is wrong. Sean O'Dell