On Thu, 6 Nov 2003 12:45:39 +0900
dblack / wobblini.net wrote:

<snip>
> I believe that's by design; as I understand it, the StrongTyping
> module performs parameter gatekeeping based exclusively on the
> class/module ancestry of an object (the namespaces to which it
> belongs, as Rich and Chad were discussing), not on what the object
> actually can do.  This means, as you say, that objects which might fit
> the bill may not get through, if their class/module ancestry is wrong,
> and also that objects which do not fit the bill can get through -- for
> example:
<snip>

This is the fundamental philosophical disagreement, or
miscommunication, or what have you.  If an object fits the bill, and
its class/ancestry is wrong, then there is a error in design.
It should not be the case that this happens, or you have found an
error in your code.

I realize not all of Ruby is documented in this manner; that's a
simple matter to change.  A few smaller modules would solve this; for
instance, Set, HashedSet, IndexedSet, etc.  Array would be an
IndexedSet; modules such as CGI would include HashedSet.  Then you
could ask for the simple behavioral pattern you desire, and know that
you have it.  You would further be assured that this #[] means what
you want it to.

This isn't really any different than duck typing, except you're just
making sure that it really does quack, it doesn't just have a bill.

-- 
Ryan Pavlik <rpav / mephle.com>

"Do not question wizards, for they are quick to
 turn you into a toad." - 8BT