Tim Bray (Sun Microsystems) on Ruby

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

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.”
ongoing by Tim Bray · On 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).

– fxn

Hi,

On Aug 13, 2006, at 5:43 AM, Xavier N. wrote:

“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).

I’m pretty sure he means ‘ad hoc polymorphism’ which is, within half
the width of a hair, the same as ‘overloading’… though, it does say
something about his world view. This is one of the only places where
types/classes are used in CLOS, at least when I write in CLOS. Though
I love working in Ruby and I understand why Ruby doesn’t support it,
I too miss this on occasion.

Cheers,
Bob

– fxn


Bob H. – blogs at <http://www.recursive.ca/
hutch/>
Recursive Design Inc. – http://www.recursive.ca/
Raconteur – http://www.raconteur.info/
xampl for Ruby – http://rubyforge.org/projects/xampl/

On Aug 13, 2006, at 3: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.”
ongoing by Tim Bray · On Ruby

Looks like he will be giving the internationalization,
multilingualization, Unicode talk at RubyConf 2006.

James Edward G. II

On 8/13/06, Bob H. [email protected] wrote:

“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).

What I find myself becoming more and more comfortable with is passing
single hashes to methods that take more than one argument, and single
arguments whenever possible. (And yes, I started doing this long
before the recent thread on functional programming :-), much of
Net::LDAP works this way). I find this to be a perfectly natural
alternative to polymorphic method signatures (even though the Python
syntax for this technique is better than Ruby’s).

As far as Tim’s polymorphic constructors go, I also find myself
avoiding constructors as much as possible in the first place. If you
have initial state in an object, that means it’s been designed (or
not-so-designed as the case may be) in a non-composable way. My recent
Ruby code has almost no inheritance and module mixins all over the
place.

On Aug 13, 2006, at 4:43 AM, Xavier N. wrote:

“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 G. II