From: Robert Dober Date: 2007-08-14T04:46:49+09:00 Subject: Re: Prototype (the real thing from Ara) problem. On 8/13/07, ara.t.howard wrote: > > On Aug 12, 2007, at 3:34 PM, Robert Dober wrote: > > > after my primitive research and my *very slow* implementation of > > Prototypes ... > > btw - i've learned something since my initial implementation: > > obj = Object.new.instance_eval do > > @var = 42 > > def method > @var > end > > self > end That is hilarious, but it will put me back to where I was fleeing from, irb(main):001:0> o = Object.new.instance_eval do irb(main):002:1* @a = 222 irb(main):003:1> def x irb(main):004:2> @a irb(main):005:2> end irb(main):006:1> self irb(main):007:1> end => # irb(main):008:0> o.x => 222 irb(main):014:0> o.extend Module::new { irb(main):015:1* def x irb(main):016:2> super.to_s << " is really " << @a.to_s(4) irb(main):017:2> end irb(main):018:1> } => # irb(main):019:0> o.x => 222 ================ of course you know about this ;) > > i was quite suprised that it worked - it would be interesting to play > with that in the context of a prototype impl. yup much food for the brain, thx for sharing. > > cheers. > > a @ http://drawohara.com/ > -- > we can deny everything, except that we have the possibility of being > better. simply reflect on that. > h.h. the 14th dalai lama Robert -- [...] as simple as possible, but no simpler. -- Attributed to Albert Einstein