How to create privacy with the use of bind()
<p>I pass an object literal into a framework method called <code>supportP()</code>.  This object literal has a special property called <code>_p</code> which denotes that the members of it are private.  From with in the object literal it can be accessed via <code>this._p</code>.  However when I pass the object literal into the "outer" scope I do not copy <code>_p</code>.  It has now been made private by omission.  In order to access _p from public member methods I bind them to the original object using <code>bind()</code> so they still have access to _p via <code>this</code>.</p>

<p>Will this work?  Are there other things to consider?  Wanted some feedback before I tested it out.</p>

<p>Below are relevant snippets.</p>

<pre><code>/*$A.supportP
**
**
**
*/
$A.supportP = function (o, not_singleton) {
    var oo
        key;
    SupportList[o.Name] = {};
    if (not_singleton) {
        // ignore this section
    } else { // *look here - isFunc returns true if a function
        for (key in o) {
            if ((key !== '_p') &amp;&amp; (isFunc(o[key])) {
                oo[key] = o[key].bind(o);
            } else if (key !== '_p') {
                oo[key] = o[key];
            } else {
                // private (_p) - anything to do here?
            }
        }
        return oo;
    }
};


/*$A.test
**
**
**
*/
var singleton_object = $A.supportP({
    _p: 'I am private',
    Name: 'test',
    publik_func: function () {
        // this will refer to this object so that it can access _p
        // this._p is accessible here due to binding
    }
}, false);
</code></pre>
