[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Oppinions on RCR for dup on immutable classes

Yukihiro Matsumoto

2/19/2007 7:57:00 AM

Hi,

In message "Re: Oppinions on RCR for dup on immutable classes"
on Sun, 18 Feb 2007 02:54:42 +0900, Stefan Rusterholz <apeiros@gmx.net> writes:

|> If we see a class as a restaurant, your illustration makes sense. But
|> from my point of view, we don't know the name of the restaurant, nor
|> its menu. We just sit and cry for "Spaghetti!", and sometimes the
|> waiter says "I'm sorry".

|The example translates to:
|Restaurant := Class
|Menucard := #methods
|Say "we don't serve that" := raised Exception

I don't deny your model, but it smells like static typing. In Ruby,
we do

obj.dup

not,

void foo(SomeClass obj) {
obj.dup();
}

We don't see any class in Ruby example, we just see an object, and
order it to dup, assuming it can dup itself, without knowing whether
it is really able to dup. If it can't, for some reason, it raises an
exception. The best illustration for the situation (in Ruby, not
being Java) is something like above "sit and order" model.

matz.