you can do shadowing with dynamicly binding, IF your two-function access 
the global scope:

var foo = 'bar' //i'm global

function one() {
  var foo = 'baz';
  two.call({foo:foo});
}
function two() {
  console.log(this.foo)
}

but in the end this is also not quite elegant, and incredibly bad. And it 
doesn't work with this:
(function(){

var foo = 'bar' //i'm global

function one() {
  var foo = 'baz';
  two.call({foo:foo});
}
function two() {
  console.log(this.foo)
}

one();
two(); // BOOM!

})()
Am Donnerstag, 11. Juli 2013 10:31:57 UTC+2 schrieb Jean-Michel Hiver:
>
> Thanks for this floby, but now I have to pass an extra argument to my 
> function, which is what I was trying to avoid... well looks like I have my 
> answer anyways, which is basically "you can have global variables, private 
> variables, but no proper lexically scoped local variables".
>
> Thanks.
> JM
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to