From: "David A. Black" Date: 2004-06-08T04:54:28+09:00 Subject: Re: How to ducktype a Hash? Hi -- On Tue, 8 Jun 2004, Austin Ziegler wrote: > Richard Kilmer [mailto:rich@infoether.com] : > > Oops...sorry...you are right...it would have to be: > > > > f.{Array}['rich'] > > > > to make it explicit that you are grouping the {} with the > > method name. This is only an issue for the operator'ish methods > > because methods require the dot in them already. > > Maybe: > > f['rich'] > f.[firstname] > > It's ugly enough to discourage its use, but it also calls to mind the > syntax for C++ templates (for good or ill) while not being > currently-legal Ruby. I think it has to be assumed that if Matz adds any type-related stuff, it will get very heavy use, ugly or not. Luckily there's little or no precedent for Matz adding ugly stuff :-) but I think this is a case where people who want to use it are not going to be deterred by how it looks, so I wouldn't want to rely on that effect. David -- David A. Black dblack@wobblini.net