И стаковерфлов о них: http://stackoverflow.com/questions/21017329/could-i-execute-function-right-before-closure-death-garbage-collection

function getRandomInt(min, max)
{
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

var server = require('http').createServer(function(request, response)
{
    var atEnd = function()
    {
        response.end('No more randoms for you.')
    };

    (function(){    

        response.statusCode = 200;
        response.setHeader('Content-Type','text/html; charset=UTF-8');

        // This loop is emulating a huge sophisticated complex async
        // callback delirium which cannot be easily understood and
        // tracked down, and I won't get paid for its refactoring.
        for(var i = 0;i < getRandomInt(0,getRandomInt(0,1000)); i++)
        {
            setTimeout(function()
            {
                response.write(String(getRandomInt(0,1000) + "<br/>"))
            },getRandomInt(0,30000))
        }

    //  What I'd wish to do:
    //  require('some-cool-module').onClosureDeath(atEnd)

    })()
}
).listen(11111);
[ ]
 
BlockingCenteredWindow = (function(){ 

    var prototype = {}
    var instances_counter = 0

    prototype.constructor = function()
    {
        this.id = ++instances_counter
    }

    prototype.render = function()
    {
        console.log(this.id)
    }

    return prototype.constructor.prototype = prototype

})().constructor;
[ ]
 
for(i = 0;i < 5;i++)
{
  with({num:i})
  {
    setTimeout(function(){console.log(num)},1000)
  }
}
[ ]
 
with(PersonClass = function(){
    console.log("Person created!")
})
{
    prototype =
    {
        name : "John Doe"
    }
}

Другие, не менее интересные способы: http://stackoverflow.com/questions/19977298/create-class-by-merging-function-and-object-in-one-statement-alternative-way-to

UPD:

with(BlockingCenteredWindow = function()
{
  
    var instances_counter = 0

    return (function()
    {
      this.id = ++instances_counter
    })

}())
{
    prototype.render = function()
    {
        console.log(this.id)
    }
}
[ ]