From: Andrea Giammarchi on
and then I realize the call is absolutely a non sense FFS! ... easy

function L(b){var i=b.indexOf(":");return
Function(b.slice(0,i),"return "+b.slice(++i))};

right, I am off with off topics here, have fun :D

Br,
Andrea Giammarchi
From: Ry Nohryb on
On May 22, 7:02 pm, Johannes Baagoe <baa...(a)baagoe.com> wrote:
> (...) But there is at least one that seemed
> very odd when it first appeared, and which has become an indispensable
> idiom - Cornford's Construct, `(function() {/*...*/}) ();`.

Maybe, at the very best, the [name both of them] construct, because
there's no doubt that it's been Douglas Crockford who has contributed
more than anybody else to its divulgation. Not Cornford nor c.l.js
neither its FAQ.

I've witnessed for the last 3+ years the influence of this group and
it's ~= nil, what a waste, what a lost opportunity, not to mention the
fact that the few (JS newbies or not) that every now and then happen
to dare to post here asking for help or advice more often than not are
immediately repelled by the harsh + impertinent answers of no help nor
valuable advice by the usual bunch of bigoted regulars.

OTOH, I and tens of thousands like me have learned of and about that
construct -and much more- in Crockford's videos.

And let's not forget that this group's FAQ is outdated and will always
be forever so until its current guardian is swapped for an -unlike
him- efficient -unlike him- maintainer -rather than guardian-.

It's a pity, it's waste, but it's the truth, and it's been a lost
opportunity: c.l.js could have been the best resource for the JS
community but instead everybody laughs at it because of this bunch of
regulars that behave as rude little men.
--
Jorge.
From: Dmitry A. Soshnikov on
On 23.05.2010 21:18, Ry Nohryb wrote:
> On May 22, 7:02 pm, Johannes Baagoe<baa...(a)baagoe.com> wrote:
>> (...) But there is at least one that seemed
>> very odd when it first appeared, and which has become an indispensable
>> idiom - Cornford's Construct, `(function() {/*...*/}) ();`.
>
> Maybe, at the very best, the [name both of them] construct, because
> there's no doubt that it's been Douglas Crockford who has contributed
> more than anybody else to its divulgation. Not Cornford nor c.l.js
> neither its FAQ.

Again, I don't understand, why the construct which existed long time
before JavaScript should be named by Crockford's or Cornford's names?
They both not relate to function expressions and their particular view
-- with a grouping operator. Yes, maybe /you/ learned it from
Crockford's video, but before it this construction (and that is much
more essential -- ideology -- of a function literal, which can be
created dynamically, passed as a funarg, or e.g. executed right after
its creation) happily existed.

So, the name is (my proposal): "An immediately invoked function"
(without specifying even that this is an expression, because it goes
without saying).

>
> I've witnessed for the last 3+ years the influence of this group and
> it's ~= nil, what a waste, what a lost opportunity, not to mention the
> fact that the few (JS newbies or not) that every now and then happen
> to dare to post here asking for help or advice more often than not are
> immediately repelled by the harsh + impertinent answers of no help nor
> valuable advice by the usual bunch of bigoted regulars.
>

Yes, unfortunately that's true. But everything can be changed. You can
also start to do it. The first step (as I see) -- do not start
irrelevant discussions which turn then to useless flame and holy wars. A
classical example: some newbie asks question about inheritance and shows
a code (about 10-20 lines). In one line some finds /alert(...)/ -- and
that's it -- nobody already remember from what the discussion was
started -- everyone now discussed on 10 pages that should be (haha)
/window.alert/ ;)

> OTOH, I and tens of thousands like me have learned of and about that
> construct -and much more- in Crockford's videos.
>

It doesn't matter who has enlighten you. This ideological constructions
have been /invented/ by other people and long time before you saw
Crockford's videos or Cornford's explanations in some newsgroup. You
don't think this newsgroup is something with sacred mission right?


> It's a pity, it's waste, but it's the truth, and it's been a lost
> opportunity: c.l.js could have been the best resource for the JS
> community but instead everybody laughs at it because of this bunch of
> regulars that behave as rude little men.

Yes, start to change it. And do it.

Dmitry.
From: Dmitry A. Soshnikov on
On 23.05.2010 17:33, Andrea Giammarchi wrote:
> On May 22, 8:27 pm, "Dmitry A. Soshnikov"<dmitry.soshni...(a)gmail.com>
> wrote:
>>
>> (fun (X) -> 2 * X end)(10). % results 20
>>
>>
>
> ah ah, the classic "lambda", I could not resist :D
>
> function L(body){
> var i = body.indexOf(":");
> return ~i ?
> Function(body.slice(0, i), "return " + body.slice(++i)) :
> Function("return " + body)
> ;
> }
>
> L("x:2*x")(10);
>


That's interesting ;)

But the same construction there is in ECMAScript:

ECMAScript:

(function (x) {
return x * 2;
})(10); // 20

Erlang:

(fun (X) ->
X * 2
)(10). % 20

And with private scope (the "invention" of which (why the heck?) is
being "awarded" to irrelevant Crockford/Cornford):

Erlang:

F = (fun (X) ->
% private
Y = 20,

% return this local FE
fun (Z) ->
X + Y + Z
end

end)(10),

F(30). % results 60

You see that Y -- is private (and closured). I guess you can build
analogue in ECMAScript.

And that's about Erlang which was invented in 1987. I'm keeping silence
about Lisp (which was invented much earlier) where parenthesis are
native for the language as a whole.

Dmitry.
From: David Mark on
Ry Nohryb wrote:
> > On May 22, 7:02 pm, Johannes Baagoe <baa...(a)baagoe.com> wrote:
>> >> (...) But there is at least one that seemed
>> >> very odd when it first appeared, and which has become an indispensable
>> >> idiom - Cornford's Construct, `(function() {/*...*/}) ();`.
> >
> > Maybe, at the very best, the [name both of them] construct, because
> > there's no doubt that it's been Douglas Crockford who has contributed
> > more than anybody else to its divulgation. Not Cornford nor c.l.js
> > neither its FAQ.

Divulgation?

> >
> > I've witnessed for the last 3+ years the influence of this group and
> > it's ~= nil,

You are clearly out of your mind.

http://www.cinsoft.net/host.html

> > what a waste, what a lost opportunity, not to mention the
> > fact that the few (JS newbies or not) that every now and then happen
> > to dare to post here asking for help or advice more often than not are
> > immediately repelled by the harsh + impertinent answers of no help nor
> > valuable advice by the usual bunch of bigoted regulars.

That's a nonsensical over-generalization that you are in no position to
make. And it sounds suspiciously like parroting to me (as I've
certainly heard this before). How do you account for the fact that so
many ideas that were first published here lead to blog posts, which then
influence the masses? Then the code pops up in the "major" libraries
years later. It's a slow dissemination process for sure, but impossible
to dismiss (except for the irretrievably dense or disingenuous).

> >
> > OTOH, I and tens of thousands like me have learned of and about that
> > construct -and much more- in Crockford's videos.

Crockford doesn't know the first thing about cross-browser scripting.
His primary message there is that you should deliberately break IE6.
Good luck with that. He's a proponent of YUI and Dojo as well. Is that
the sort of thing you want to learn?

> >
> > And let's not forget that this group's FAQ is outdated and will always
> > be forever so until its current guardian is swapped for an -unlike
> > him- efficient -unlike him- maintainer -rather than guardian-.

Never mind the FAQ. It's largely irrelevant.

> >
> > It's a pity, it's waste, but it's the truth,

Statements prefaced by "it's the truth" are typically whoppers of such
magnitude as to insult the reader's intelligence.

> > and it's been a lost
> > opportunity: c.l.js could have been the best resource for the JS
> > community but instead everybody laughs at it because of this bunch of
> > regulars that behave as rude little men.

Who is everybody? Perhaps you are hanging out with the wrong crowd.

And you are hardly one to talk about being "rude" or "little". And God
knows you are laughable as well. :)