[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Tim Bray (Sun Microsystems) on Ruby

zoat

8/13/2006 8:35:00 AM

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/...

5 Answers

Xavier Noria

8/13/2006 9:43:00 AM

0

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/...

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


Bob Hutchison

8/13/2006 12:56:00 PM

0

Hi,

On Aug 13, 2006, at 5: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/...
>
> 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).

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 Hutchison -- blogs at <http://www.rec...
hutch/>
Recursive Design Inc. -- <http://www.rec...>
Raconteur -- <http://www.raconteur...
xampl for Ruby -- <http://rubyforge.org/projects/...




Francis Cianfrocca

8/13/2006 1:26:00 PM

0

On 8/13/06, Bob Hutchison <hutch@recursive.ca> 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.

James Gray

8/13/2006 3:40:00 PM

0

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."
> http://www.tbray.org/ongoing/When/200x/2006/...

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

James Edward Gray II

James Gray

8/13/2006 3:45:00 PM

0

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/...
>
> 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