On 02/03/2012 02:28, Adam D. Ruppe wrote:

3) The JS language doesn't have block scoping like D.

Have you considered faking scopes in JS using anonymous functions?

----
var foo;

(function(a, b){
        var foo; // not the same as the foo outside the func!
        // do stuff
}(x, y)); // invoke immediately with needed arguments from outer scope

----

by passing all the parameters to the anon func you get a speed increase in the lookup on most JS platforms.

I don't think they are very pretty, but it is sometimes a useful technique.

A...

Reply via email to