From: Bulat Ziganshin Date: 2002-10-03T13:26:22+09:00 Subject: Re: thoughts on typelessness Hello Christoph, Wednesday, October 02, 2002, 8:42:56 PM, you wrote: C> I am wondering if you intended to write C> class Float C> def initialize(MyType arg) C> ... C> end C> end C> (note Float.new is currently disable and I don't see any reason C> to change this ...) . Assuming that Ruby had overloading C> you could write this as C> def Float(MyType arg) C> ... C> end C> but this can, as Goto pointed out, already be done (imo more C> elegantly) by delegating the conversion to the MyType class C> module Kernel C> def Float(arg) C> arg.to_float # or to_flt C> end C> end C> /Btw . Following C++'s example of mixing type C> conversion and overloading is imo a really C> terrible idea .. yes, i think about Float.new(arg). lack of operator() is one of ruby compromises :( but about conversion - definitely we must go into direction of generic interfaces: module Kernel def Float(arg) arg.to(Float) end end of course, pattern matching when declaring arguments would help in this case -- Best regards, Bulat mailto:bulatz@integ.ru