Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28996 > unrolled thread
| Started by | Gene Wirchenko <genew@telus.net> |
|---|---|
| First post | 2015-12-09 10:55 -0800 |
| Last post | 2015-12-10 00:26 +0100 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.lang.javascript
And Another function Question Gene Wirchenko <genew@telus.net> - 2015-12-09 10:55 -0800
Re: And Another function Question Luuk <luuk@invalid.lan> - 2015-12-09 21:13 +0100
Re: And Another function Question RobG <rgqld@iinet.net.au> - 2015-12-09 19:23 -0800
Re: And Another function Question Luuk <luuk@invalid.lan> - 2015-12-10 20:06 +0100
Re: And Another function Question Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-09 18:50 -0200
Re: And Another function Question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-09 21:47 +0000
Re: And Another function Question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-10 01:10 +0000
Re: And Another function Question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-10 00:26 +0100
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2015-12-09 10:55 -0800 |
| Subject | And Another function Question |
| Message-ID | <34ug6btki29u124smhr293cd4j8cu31de8@4ax.com> |
Hello:
What does (contrived example follows)
(function(a,b,c){some_code})(1,2,3);
mean?
Is this to define an unnamed function with code some_code and
then immediately call it with the parms 1,2,3?
What is a good reference for this? I am willing to put in study
time, but I do not even know where to start.
Sincerely,
Gene Wirchenko
[toc] | [next] | [standalone]
| From | Luuk <luuk@invalid.lan> |
|---|---|
| Date | 2015-12-09 21:13 +0100 |
| Message-ID | <56688b55$0$23744$e4fe514c@news.xs4all.nl> |
| In reply to | #28996 |
On 09-12-15 19:55, Gene Wirchenko wrote:
> Hello:
>
> What does (contrived example follows)
> (function(a,b,c){some_code})(1,2,3);
> mean?
>
> Is this to define an unnamed function with code some_code and
> then immediately call it with the parms 1,2,3?
>
> What is a good reference for this? I am willing to put in study
> time, but I do not even know where to start.
>
> Sincerely,
>
> Gene Wirchenko
>
you could start here:
http://www.ecmascript.org/
or here:
http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf
[toc] | [prev] | [next] | [standalone]
| From | RobG <rgqld@iinet.net.au> |
|---|---|
| Date | 2015-12-09 19:23 -0800 |
| Message-ID | <3a9e1892-4a0d-44e0-81c4-fafd8fcba550@googlegroups.com> |
| In reply to | #28997 |
On Thursday, December 10, 2015 at 6:13:19 AM UTC+10, Luuk wrote: [...] > you could start here: > http://www.ecmascript.org/ > > or here: > http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf Expecting a novice to understand immediately invoked function expressions simply by reading the latest language specification is not realistic. If it was helpful, it would be the answer to most of the ECMAScript questions asked here. But it's not, so it isn't. -- Rob
[toc] | [prev] | [next] | [standalone]
| From | Luuk <luuk@invalid.lan> |
|---|---|
| Date | 2015-12-10 20:06 +0100 |
| Message-ID | <5669cd37$0$23751$e4fe514c@news.xs4all.nl> |
| In reply to | #29007 |
On 10-12-15 04:23, RobG wrote: > On Thursday, December 10, 2015 at 6:13:19 AM UTC+10, Luuk wrote: > [...] >> you could start here: >> http://www.ecmascript.org/ >> >> or here: >> http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf > > Expecting a novice to understand immediately invoked function expressions simply by reading the latest language specification is not realistic. If it was helpful, it would be the answer to most of the ECMAScript questions asked here. > The OP was not claiming to be a novice... > But it's not, so it isn't. > So, he's not (a novice)..... ;)
[toc] | [prev] | [next] | [standalone]
| From | Joao Rodrigues <groups_jr-1@yahoo.com.br> |
|---|---|
| Date | 2015-12-09 18:50 -0200 |
| Message-ID | <n4a466$bvo$1@speranza.aioe.org> |
| In reply to | #28996 |
Em 09/12/2015 16:55, Gene Wirchenko escreveu:
> Hello:
>
> What does (contrived example follows)
> (function(a,b,c){some_code})(1,2,3);
> mean?
>
> Is this to define an unnamed function
^^^^^^^^
I'd rather say an "anonymous" function.
> with code some_code and
> then immediately call it with the parms 1,2,3?
Exactly.
>
> What is a good reference for this? I am willing to put in study
> time, but I do not even know where to start.
>
Ben Alman has written a good article about IIFEs:
<http://benalman.com/news/2010/11/immediately-invoked-function-expression/>
--
Joao Rodrigues
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2015-12-09 21:47 +0000 |
| Message-ID | <87a8pj47le.fsf@bsb.me.uk> |
| In reply to | #28996 |
Gene Wirchenko <genew@telus.net> writes:
> What does (contrived example follows)
> (function(a,b,c){some_code})(1,2,3);
> mean?
>
> Is this to define an unnamed function with code some_code and
> then immediately call it with the parms 1,2,3?
Yes.
> What is a good reference for this? I am willing to put in study
> time, but I do not even know where to start.
Sorry, I can't help there. The general notion -- that of anonymous
functions -- is found in many languages. If you knew, for example,
Lisp, almost nothing in EcmaScript would be new to you, but you probably
want a language specific reference, and I have not researched that.
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2015-12-10 01:10 +0000 |
| Message-ID | <87si3b2jni.fsf@bsb.me.uk> |
| In reply to | #29000 |
ram@zedat.fu-berlin.de (Stefan Ram) writes: > Ben Bacarisse <ben.usenet@bsb.me.uk> writes: >>Sorry, I can't help there. The general notion -- that of anonymous >>functions -- is found in many languages. If you knew, for example, >>Lisp, almost nothing in EcmaScript would be new to you, but you probably >>want a language specific reference, and I have not researched that. > > »14.1 Function Definitions« gives the syntax for > »FunctionExpression« and says that a »FunctionExpression« > starts with the token »function«. Sure, but I did not think the OP wanted a reference to the language specification. I though they wanted some resource to learn about such usages. By "language specific reference" I meant something to learn about this style but using EcmaScript not, say, Lisp or ML. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-12-10 00:26 +0100 |
| Message-ID | <11602512.mtjsSYLier@PointedEars.de> |
| In reply to | #28996 |
Gene Wirchenko wrote:
> What does (contrived example follows)
> (function(a,b,c){some_code})(1,2,3);
> mean?
>
> Is this to define an unnamed function with code some_code and
> then immediately call it with the parms 1,2,3?
Yes. The proper term is “anonymous function (expression)” rather than
“unnamed function”.
> What is a good reference for this? I am willing to put in study
> time, but I do not even know where to start.
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions#Function_expressions>
Also referred to by – you probably have guessed it – the FAQ.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web