Execution context, Identifier resolution, Variable instantiation

A

Asen Bozhilov

Now please somebody brave enough to tell me this argument is obvious,
expected, and my solution is wrong ... I think we should simply be
more constructive, avoiding these kind of nonsense blames ... I mean,
16 replies to a troll which life aim is to blame me and my blog? I was
expecting a bit more professionalism here but I am sure it is not
always like this.

Regards

Where i say "Your solution is wrong."? You call me troll, arrogant,
etc. I want just clear explanations. Your explanations in that article
is totally wrong. See my first post in this topic. Read again post of
Thomas Lahn. Read Richard Cornford article for closure:
<URL: http://www.jibbering.com/faq/faq_notes/closures.html >
Read Soshnikov articles about ECMA262, maybe soon will be translate in
English. But see example of Soshnikov.
<URL: http://javascript.ru/blog/dmitry-a.-soshnikov >
Read ECMA262 documentation. After that come back again and say what
are you think about your article and terms which been used in
""Internet Explorer Scope Resolution".
 
A

Andrea Giammarchi

Dmitry .. that is a scoped example for a post called scope resolution
and a generic solution with a foo variable.
I replied to you 'cause I agreed with you and nothing else ... no need
to comment the fact a single generic example does not need a closure,
that is a single generic example ...

Richard ... so you like a stack trace loads of anonymous, I don't, and
let's see in a "closured" library loads of functions who can spot
instantly the problematic one: you with an anonymous proof eye?

Moreover, you skipped the timers part ... and you use
arguments.callee, don't you?
Me too, but somebody decided that with "use strict" and ES5
arguments.callee should not be there anymore and again we are trying
to make things simpler, this is the background of the story and as
long as this is OK tell me who has rights to say that post should
closed ... even if was obvious not everybody gets JScript behavior and
since the author of this post did not get it neither and the web is
loads of obvious things, can anybody explain all this effort against a
misunderstood post?

Btw, Dmitry, the example is valid for a timer as well, rather than the
external var foo assigned, we could assign the callee runtime via
closure and that technique but yes, as is in a post that have an
history behind apparently nobody read, the closure is not necessary.

Thomas, it's just for you guys, if you gonna waste all this time for
every troll of this world good luck ... I have honestly something else
to do, rather than follow every Bozhilov blame ... I do hope at least
Bozhilov learned something by this thread (I kinda doubt it
though ... )

Regards
 
D

Dmitry A. Soshnikov

Dmitry .. that is a scoped example for a post called scope resolution
and a generic solution with a foo variable.
I replied to you 'cause I agreed with you and nothing else ... no need
to comment the fact a single generic example does not need a closure,
that is a single generic example ...
[...]

Oh, I've just mentioned that there's no any difference in case of the
last example (step 5 in your slides) - no matter about scoped example
or generic you're talking about. Anyway, FD will be attached as a
property of the *current* VO/AO. And from this point of view it
doesn't matter are you in global context or in enclosed (e.g. function
context).

The other thing if you have only one if-statement (without else) - in
this case with using enclosing context the difference is that no any
function will be created.

Moreover, if to delete [var] identifier, foo will still be available
which sure won't be with enclosing context:

eval('var foo;'); // to be able to delete
if (true) {
foo = function foo(){/* 1 */};
} else {
foo = function foo(){/* 2 */};
}
foo(); // 1
delete foo;
foo(); // 1

So, yeah, in general the case with assignment and enclosing scope - is
better - I understand and know it, the suggestion was just on you step
5 example.

But even with enclosing context but without any assignment to
variable, JScript keeps two objects with the same name - [foo] (I
guess you know it sure):

var foo = (function(){
if (true) {
return function foo(){
alert(1);
foo(); // no recursive stack overflow, but - 2
};
} else {
return function foo(){
alert(2);
};
}
})();

foo();

This example alerts 1 and 2 and in call stack we see [foo], [foo].
Btw, Dmitry, the example is valid for a timer as well, rather than the
external var foo assigned, we could assign the callee runtime via
closure and that technique but yes, as is in a post that have an
history behind apparently nobody read, the closure is not necessary.
[...]

I'm not sure I understand what do you mean saying timer won't work.

var foo;
if (true) {
foo = function foo(){/* 1 */};
} else {
foo = function foo(){/* 2 */};
}
setTimeout(foo, 0); // in debugger you have name [foo] with [1]

/ds
 
T

Thomas 'PointedEars' Lahn

Andrea said:
Thomas, it's just for you guys, if you gonna waste all this time for
every troll of this world

No, I am not going to waste any more of my time for you.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top