On 8/13/07, ara.t.howard <ara.t.howard / gmail.com> 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
=> #<Object:0xb7d648c4 @a=222>
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> }
=> #<Object:0xb7d648c4 @a=222>
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