From: James Edward Gray II Date: 2006-08-14T00:45:29+09:00 Subject: Re: Tim Bray (Sun Microsystems) on Ruby On Aug 13, 2006, at 4:43 AM, Xavier Noria wrote: > On Aug 13, 2006, at 10:35 AM, zoat wrote: > >> The Director of Web Technologies at Sun Microsystems jumps >> directly to >> the conclusion about Ruby. "For people like me, who are proficient in >> Perl and Java, Ruby is remarkably, perhaps irresistibly, attractive." >> http://www.tbray.org/ongoing/When/200x/2006/07/24/Ruby > > Just for the archives, at the end of the post it reads: > > "Finally, a minor, almost a footnote, issue. I miss polymorphism. > In particular, I miss polymorphic constructors." > > but Ruby does have polymorphism. I guess he means "method > overloading" (which can be partially mimicked with default arguments). Hmm, I would say you would mimic this by accepting any number of arguments: def initialize(*args) if # check args.size and type... init_with_whatever(*args) elsif # check args.size and type... init_with_whatever_else(*args) else raise ArgumentError, "#{args.inspect} not a supported call." end end You could generalize this into a library, of course, and I'm pretty sure people have. James Edward Gray II