D to Javascript converter (a hacked up dmd)
Alix Pexton
alix.DOT.pexton at gmail.DOT.com
Fri Mar 2 01:33:54 PST 2012
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...
More information about the Digitalmars-d-announce
mailing list