From: "David A. Black" Date: 2004-09-29T06:27:57+09:00 Subject: Re: Best name for "this method" ? Hi -- On Wed, 29 Sep 2004, trans. (T. Onoma) wrote: > On Tuesday 28 September 2004 05:44 am, Gavin Sinclair wrote: > >   foo.methods[:new, :protected]   # if you need combination > > This line's got me thinking... How does one define a class [] constructor? For > example Hash can be use like this: > > Hash[:a=>1,:b=>2 ] class C def C.[](...) ... end end > And then I start to wonder why we can't just use the class name like a method? > > Hash(:a=>1, :b=>2) You can define such methods; for example, there's Integer. A number of people (including me :-) aren't big fans of method names that begin with uppercase letters, but it can be done. David -- David A. Black dblack@wobblini.net