From: Stoyan on
Moving a discussion from twitter... Let's name this pattern :)

Some ideas include:
- self-executing function
- immediate function
- immediate invokation
- lexical block


Some thoughts:

@cowboy: IMO self-executing: function foo(){ foo(); }; Immediately
invoked: (function(){ ... })();

@abozhilov: I think that pattern need more abstract name. The
intention of pattern instead technical terms. and `(function (){})()`
is just one possibility for implementation these purposes.

@kangax: "immediate function" sounds a little awkward to me :) but
with "invocation" it's fine — "immediate invocation"

@DmitrySoshnikov no less than "self-executing". This term maybe fits
to recursive function, because exactly it executes itself. Immediate
invocation fits better for (correct naming) - an (anonymous) FE which
executes (by the engine, but not itself) right after its creating.
"Immediate function" seems apt, meaning "Immediate invocation of a FE
right after FE's creation".

Opinions?
From: Thomas 'PointedEars' Lahn on
Stoyan wrote:

> Moving a discussion from twitter... Let's name this pattern :)

No, thanks. This is _not_ a chat, we've been over this ad nauseam, and
naming the expression differently than what the Specification says (which is
understood by all involved because of that) serves no practical purpose. It
is a waste of time.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
From: Garrett Smith on
Stoyan wrote:
> Moving a discussion from twitter... Let's name this pattern :)
>
> Some ideas include:
> - self-executing function

The function does not execute itself.

> - immediate function
The immediately invoked function itself is not immediate.

> - immediate invokation
Why only one k?
Describes the mechanics but not the application. Function that returns a
value is a bit different.

~function(){
Lib.addCallbac(anObj, "onevent", localFn);

function localFun() { /*...*/ }
}

> - lexical block
Less technically descriptive but seems more to the point of usage.

Immediately invoked function describes what it is correctly. It does not
explain how or why it is used, or if a value is explicitly returned, but
it is still my preference because it is technically correct.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: RobG on
On May 14, 6:53 am, Stoyan <sst...(a)gmail.com> wrote:
> Moving a discussion from twitter... Let's name this pattern :)
>
> Some ideas include:
> - self-executing function
> - immediate function
> - immediate invokation
> - lexical block
>
> Some thoughts:
>
> @cowboy: IMO self-executing: function foo(){ foo(); }; Immediately
> invoked: (function(){ ... })();
>
> @abozhilov: I think that pattern need more abstract name. The
> intention of pattern instead technical terms. and `(function (){})()`
> is just one possibility for implementation these purposes.
[...]
> Opinions?

Before you can choose between various responses, you must first
establish the evaluation criteria. Here are some, in no particular
order.

The name:

* Should bear no resemblance whatever to what it actually is or does,
e.g. AJAX, Web 2.0, .NET, Cocoa, etc. Names like WebKit clearly fail
this criterion

* Should be catchy and annoy anyone who actually knows what it is
supposed to mean (see examples above). Even better if it's ambiguous
or misleading (extra points for both)

* Must have strange capitalisation and misspelling

* May have reference to some historical person who is vaguely related
to its invention, popularisation or folk lore, e.g. Yann-Erwan Perio
(YEP) or Richard Cornford

Some suggestions:

1. KwikExp

2. KwkFn

3. YepExp or YepFn

4. Yepify, Cornify (cf. currying[1])

and so on.

1. <URL: http://en.wikipedia.org/wiki/Currying >


--
Rob
From: David Mark on
RobG wrote:
> On May 14, 6:53 am, Stoyan <sst...(a)gmail.com> wrote:
>> Moving a discussion from twitter... Let's name this pattern :)
>>
>> Some ideas include:
>> - self-executing function
>> - immediate function
>> - immediate invokation
>> - lexical block
>>
>> Some thoughts:
>>
>> @cowboy: IMO self-executing: function foo(){ foo(); }; Immediately
>> invoked: (function(){ ... })();
>>
>> @abozhilov: I think that pattern need more abstract name. The
>> intention of pattern instead technical terms. and `(function (){})()`
>> is just one possibility for implementation these purposes.
> [...]
>> Opinions?
>
> Before you can choose between various responses, you must first
> establish the evaluation criteria. Here are some, in no particular
> order.
>
> The name:
>
> * Should bear no resemblance whatever to what it actually is or does,
> e.g. AJAX, Web 2.0, .NET, Cocoa, etc. Names like WebKit clearly fail
> this criterion
>
> * Should be catchy and annoy anyone who actually knows what it is
> supposed to mean (see examples above). Even better if it's ambiguous
> or misleading (extra points for both)
>
> * Must have strange capitalisation and misspelling
>
> * May have reference to some historical person who is vaguely related
> to its invention, popularisation or folk lore, e.g. Yann-Erwan Perio
> (YEP) or Richard Cornford
>
> Some suggestions:
>
> 1. KwikExp
>
> 2. KwkFn

Hell, why not HuckFinn? :)

>
> 3. YepExp or YepFn
>
> 4. Yepify, Cornify (cf. currying[1])

Some may say "Crockify", but then they'd be wrong. :)

>
> and so on.
>

What's wrong with one-off? ISTM that's what Richard has always called
it (and it fits).