new self invoking function

D

David Mark

NFEs ? Avoided ? Why ? NFEs are *not* the problem, the problem is
Microsoft.

*Named* NFE's. And the problem is not MS, but your refusal to deal
with the reality of their bugs. Pretending they don't exist is not a
sound strategy.
Global symbols: global vars, global objects, global mehtods, etc, all
of them properties of the Global Object

So what? That doesn't mean you should refer to all of them as
"variables".
(the one that 'window'
aliases)

We've been over that.
 
D

David Mark

The appearance of
  "the globally defined variable NaN" and
  "the globally defined variable Infinity"
in ECMA 262 v3 sec 8.5 suggests that some knowledgeable people disagree
with you.

You seem to have missed the point that it is not a matter of knowledge
but communication. The specs are written for *implementors*, not
programmers. That's why JS programmers don't refer to the language as
"ECMAScript" and rarely talk of syntax in terms of "productions". ;)

As usual with dogmatic people you have failed to suggest a sensible term
for the general case, in this case covering everything that can be
assigned from and assigned to if not ReadOnly. That's the real recipe
for confusion.

There is no need for a term for such a general case (except perhaps
for implementors). Trying to use such a term in programming
discussions will only serve to confuse.
 
R

Ry Nohryb

*Named* NFE's. (...)

Yes, the truly, really well named ones: named-named-function-
expressions :)
And the problem is not MS, but your refusal to deal
with the reality of their bugs. (...)

You should avoid the IEs, not the NFEs... and I have a plan for this:
do you want to know more ?
 
G

Garrett Smith

You seem to have missed the point that it is not a matter of knowledge
but communication. The specs are written for *implementors*, not
programmers. That's why JS programmers don't refer to the language as
"ECMAScript" and rarely talk of syntax in terms of "productions". ;)
Of all possible arguments could have been made, that one is truly lousy.

Specification terminology is absolutely appropriate for posts on
comp.lang.javascript.
 
D

David Mark

Of all possible arguments could have been made, that one is truly lousy.

No, you simply can't grasp the difference, which is why you are a
truly lousy communicator.
Specification terminology is absolutely appropriate for posts on
comp.lang.javascript.

That's a ridiculous generalization.
 
G

Garrett Smith

No, you simply can't grasp the difference, which is why you are a
truly lousy communicator.

What I wrote was unambiguous and clear. Apparently I communicated
effectively because you understood exactly what I meant.
That's a ridiculous generalization.

It is neither; it is a universal truth.

And it is the reason that your initial argument was lousy one.

Anyone who has read the group for several years, has seen the use of
specification terminology to describe the language in posts from
Cornford, Lasse, Lahn, John G Harris. Though none from you.

You can't really invalidate specification terminology by claiming that
the specification was not intended for programmers; all that does is
justify your apparent unwillingness to RTFM.
 
D

David Mark

What I wrote was unambiguous and clear.

In your mind. To anyone else reading this, it is likely clear that
you have poked your head into a technical discussion to add nothing
but your own personal and juvenile nonsense.
Apparently I communicated
effectively because you understood exactly what I meant.

You try too hard.
It is neither; it is a universal truth.

It certainly is not.
And it is the reason that your initial argument was lousy one.
Nope.


Anyone who has read the group for several years, has seen the use of
specification terminology to describe the language in posts from
Cornford, Lasse, Lahn, John G Harris.

Of course, you missed the point again. Each discussion in this group
has a context. There are times when such language is appropriate and
times when it is not.
Though none from you.

That's not true. Just another gross generalization on your part (and
a lame attempt to puff up your own ego).
You can't really invalidate specification terminology by claiming that
the specification was not intended for programmers; all that does is
justify your apparent unwillingness to RTFM.

No such unwillingness is apparent; not even to you. You are simply a
basket case who has tried and failed to make a career out of
memorizing specifications. As we've seen over and over, such
memorization (and incessant regurgitation, often in inappropriate
contexts) does not buy you a thing.
 
D

David Mark

Yes, the truly, really wellnamedones:named-named-function-
expressions :)

Nice catch, jackass. Commenting on obvious typos is about what I'd
expect from you.
You should avoid the IEs, not the NFEs... and I have a plan for this:
do you want to know more ?

Your plan has been heard and shot down. Get better Jorge.
 
D

David Mark

On Aug 8, 8:01 pm, Garrett Smith

[...]
Anyone who has read the group for several years, has seen the use of
specification terminology to describe the language in posts from
Cornford, Lasse, Lahn, John G Harris. Though none from you.

I cite the specification when the context calls for it. For example,
three years ago you asked me to explain to you why 0 is not less than
null (presumably to avoid RTFM yourself).

http://groups.google.com/group/comp.lang.javascript/msg/55dd0547c67e99a1

Bets that I won't bother to dig up an old post to deflect your dubious
claims usually "pay". Not your lucky day it seems. :)
 
G

Garrett Smith

In your mind. To anyone else reading this, it is likely clear that
you have poked your head into a technical discussion to add nothing
but your own personal and juvenile nonsense.


You try too hard.

I can't see why that's worth arguing. I wrote something clear and you
got what I meant.
It certainly is not.

No. Specification terminology is absolutely appropriate for on-topic
posts on javascript.

If you don't like that, or post things that are continually off-topic
material for whatever reason (stubbornness, arrogance, insanity, and it
doesn't really matter what your personal problems are) then don't post
any more.

Your post is off-topic.

Off-topic material, such as interspersed unrelated emotional remarks,
within a technical discussion are plaguing this group. The spam at least
appears in a separate thread, so it can be easily ignored. Your trash
appears all over the place.
 
D

David Mark

I can't see why that's worth arguing. I wrote something clear and you
got what I meant.

You can't see much of anything it seems.
No. Specification terminology is absolutely appropriate for on-topic
posts on javascript.

Again with the generalization.
If you don't like that, or post things that are continually off-topic
material for whatever reason (stubbornness, arrogance, insanity, and it
doesn't really matter what your personal problems are)

LOL. Pot calling the kettle black again.
then don't post
any more.

Your post is off-topic.

Shut up, twit. Now that's off-topic, but still much needed at this
point.
Off-topic material, such as interspersed unrelated emotional remarks,
within a technical discussion are plaguing this group.

So stop popping in to technical discussions with personal attacks (and
then whining when you get smacked on the nose).
The spam at least
appears in a separate thread, so it can be easily ignored. Your trash
appears all over the place.

I assume you've read the next post and are now crying in a corner
somewhere. :)
 
G

Garrett Smith

On Aug 8, 8:01 pm, Garrett Smith
[...]

I cite the specification when the context calls for it. For example,
three years ago you asked me to explain to you why 0 is not less than
null (presumably to avoid RTFM yourself).

http://groups.google.com/group/comp.lang.javascript/msg/55dd0547c67e99a1

That's a good example of an on-topic post, so you're capable of posting
on-topic.

There's a big difference between that and obnoxious noise, massive
overquoting, and lazy and sloppy formatting that makes up the majority
of your postings.
 
G

Garrett Smith

Nice catch, jackass.

Try repeating that looking in the mirror.

Commenting on obvious typos is about what I'd
expect from you.

Is there a contradiction here?

Either you're concerned about using correct terminology or you're not.
Frankly I don't care about what you call it; you've shown repeated
unwillingness to hold civil technical discussion, trying to discuss
anything with you is pretty much a waste of time anyway, so call it
whatever you want and I'll happily ignore you.

if you tried to correct Jorge and then posted wrong information again
(that's about the fourth post in a row from you I've read today that
follows that pattern).
 
G

Garrett Smith

[...]

So stop popping in to technical discussions with personal attacks (and
then whining when you get smacked on the nose).
The spam at least
appears in a separate thread, so it can be easily ignored. Your trash
appears all over the place.

I assume you've read the next post and are now crying in a corner
somewhere. :)

It sounds like you want to get a little more personal.

Sissy flame wars are off-topic. If you wanted to meet in person -- and
that goes for anyone -- you could have just emailed me rather than post
a sissy drama queen act with keystrokes. You have my email address.

I'm not getting hit in the nose and although your trash hurts my ideals
for this NG, I'm surely not crying.
 
H

Hubert Kauker

myNamespace =  {}; //namespace for holding any objects/functions

//helpModule as an example
myNamespace.HelpModule = new (function(){
    this.abc = '123';
    //lots of other code in here...
    return this;

})();

What we have here is the application of the 'new' operator to an
anonymous constructor function.
Seems entirely legitimate to me and not at all obscure.

However, I would drop the 'return' statement inside the body.
 
R

Ry Nohryb

What we have here is the application of the 'new' operator to an
anonymous constructor function.
Seems entirely legitimate to me and not at all obscure.

It's not too obscure, but IMO this is better (clearer):

myNamespace.HelpModule= {};
myNamespace.HelpModule.abc= "123";
myNamespace.HelpModule.aMethod= function(){ ... };
....etc
However, I would drop the 'return' statement inside the body.

Yep, it's not needed.

The (function () {})() pattern is being used too often gratuitously,
for no reason, such as in this FAQ entry:
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/b9aede5baeb64755#

var numberToFixed =
(function() {
return toFixedString;
(...)
 
R

Ry Nohryb

What we have here is the application of the 'new' operator to an
anonymous constructor function.
Seems entirely legitimate to me and not at all obscure.

Ah, and that extra () at the end aren't wanted: it should be new
function(){}; or new (function(){}); but not new (function(){})();
 
E

Evertjan.

Garrett Smith wrote on 09 aug 2010 in comp.lang.javascript:
Of all possible arguments could have been made, that one is truly lousy.

Specification terminology is absolutely appropriate for posts on
comp.lang.javascript.

Arguments in this NG's terminology are the parameters of a function.

;-)
 
R

Ry Nohryb

Well, what is the correct way to think about scope in Javascript? I tend
to think of it as

global
|_ function
   |_ inner function
      |_ inner, inner function
         |_ etc...

but that's probably naive.

It's perfect, that's the way it is, but only if the graph is showing
function declarations and not function calls (only if it's not a call
chain):

NOT:
function f () { var k= 27; return inner() }
function inner () { return innerinner() }
function innerinner () { return k }

f()
--> ReferenceError: Can't find variable: k
Call chain: f()-->inner()-->innerinner()

YES:
function f () {
var k= 27;
return inner();
function inner () {
return innerinner();
function innerinner () { return k }
}
}

f()
--> 27
Call chain: f()-->inner()-->innerinner()
 
R

Ry Nohryb

thx, yeah that makes sense. I wonder if the following code from Mozilla
Dev Center kind of illustrates the tendency to conflate scope with the
this object?
I know 'scope' in this function is only a local variable *name*, but it
struck me as kind of a misleading in the 'way to think about it'
department...
if (!Array.prototype.forEach) {
    Array.prototype.forEach = function(fn, scope) {
        scope = scope || this;
        for(var i = 0; i < this.length; i++) {
            fn.call(scope, this, i, this);
        }
    };
}


Oops, had my head up my butt on that one. I meant to say 'argument
name', not 'local variable name', and that function is *not* from
Mozilla, I believe it's from one of the Sitepoint books.


Yep, it's very often that I see too 'this' called "the scope",
nowadays. Maybe it's so called in some other language... (?)
 

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

No members online now.

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top