Can I overload an object with a function?
<p>Let's say I have an object of functions/values. I'm interested in overloading based on calling behavior.</p>

<p>For example, this block of code below demonstrates what I wish to do.</p>

<pre><code>var main_thing = {
    initalized: false,
    something: "Hallo, welt!",
    something_else: [123,456,789],
    load: {
        sub1    : function() {
            //Some stuff
        },
        sub2    : function() {
            //Some stuff
        },
        all     : function() {
            this.sub1();
            this.sub2();
        }
    }
    init: function () {
        this.initalized=true;
        this.something="Hello, world!";
        this.something_else = [0,0,0];
        this.load(); //I want this to call this.load.all() instead.
    }
}
</code></pre>

<p>The issue to me is that <code>main_thing.load</code> is assigned to an object, and to call <code>main_thing.load.all()</code> would call the function inside of the object (the <code>()</code> operator). What can I do to set up my code so I could use <code>main_thing.load</code> as an access the object, and <code>main_thing.load()</code> to execute some code? Or at least, similar behavior.</p>

<p>Basically, this would be similar to a default constructor in other languages where you don't need to call main_thing.constructor().</p>

<p>If this isn't possible, please explain with a bit of detail.</p>
