From: "Victor \"Zverok\" Shepelev" Date: 2007-06-06T05:33:42+09:00 Subject: Re: [ANN] prototype-2.0.0 From: ara.t.howard [mailto:ara.t.howard@gmail.com] Sent: Tuesday, June 05, 2007 11:03 PM >On Jun 5, 2007, at 12:55 PM, Victor Zverok Shepelev wrote: > >> From: ara.t.howard [mailto:ara.t.howard@gmail.com] >> Sent: Tuesday, June 05, 2007 6:33 AM >> >> >>> NAME >>> prototype.rb >>> >> >> Several small questions about the library: >> >> * Does cloned object has some connections with it's prototype (as >> per Io: >> "prototype is something knowing how to process messages I don't know") >> > >yes. if one does > > clone = Object.prototype{ @a = 42 }.clone > >the clone has a #a method from parent and @a instance var if it's own It's understandable. I've meant the case a = Object.prototype{ @x = 42 } b = a.clone a.extend { def my_new_method; puts "here!" end } b.my_new_method #will b have ALL the methods of it's prototype? assert_equal b.prototype, a #is there a way to obtain b's prototype? #we also can think this way: def b.method_missing(:sym) self.prototype.send(:sym) end I'm not prototype-based guru, of course. What I want to say. I've started to think about prototype-based programming from Io and JavaScript. My very first impression was "I create objects, I clone objects, that's all". But further I've found, the more experienced people think about prototype-based as "each object has it's prototype" first of all (which becames "object's prototype processes all unknown signals", "object's prototype can be changed" and even Io's "prototype defines lexical scope"). It seems prototype.rb now does something like "my first impression", not "prototype-based entirely". Am I wrong? V.