Accessing reference of Class inside itself while in different context
<pre><code>function Foo(){

}
Foo.prototype={
    foo:'some text'
    ,bar:function(){
        console.log('Want to be able to retrieve foo of Foo',this.foo);
    }
}

var instance=new Foo();
instance.bar.apply({});
</code></pre>

<p>Here is link to jsfiddle:</p>

<p><a href="http://jsfiddle.net/dnJFt/1/" rel="nofollow">http://jsfiddle.net/dnJFt/1/</a></p>

<p>I was trying to play with scopes putting class building inside wrapper with <code>var self</code> inside it. And after returning <code>instance of Class</code>, refer it to <code>var self</code> like that:</p>

<pre><code>function Foo() {
    var self;
    function Foo_in(){

    }
    Foo_in.prototype={
        foo:'some text'
        ,bar:function(){
            console.log('Want to be able to retrieve foo of Foo',self);
        }
    }
    return self=new Foo_in();
}

var instance=new Foo();
instance.bar.apply({});
</code></pre>

<p>Here is link to jsfiddle:
<a href="http://jsfiddle.net/dnJFt/2/" rel="nofollow">http://jsfiddle.net/dnJFt/2/</a></p>

<p>But my solution is bad, because each time i'm rebuilding <code>Class</code> and it's prototype methods.</p>

<p>Is there an easier solution?</p>
