Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15707
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Wed, 05 Sep 2012 10:02:11 -0500 |
| From | Jim T. <x@y.z> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: FAQ Topic - What is a function statement? (2012-09-05) |
| Date | Wed, 05 Sep 2012 11:09:17 -0400 |
| Message-ID | <gmqe48pjsbl6qu00ko6a9ou6ougen9h257@4ax.com> (permalink) |
| References | <504687f9$0$295$14726298@news.sunsite.dk> |
| X-Newsreader | Forte Agent 1.93/32.576 English (American) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Lines | 58 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-YNkiKx8cuVV01ler90B/PiqMZVIMarR2cYlkkZZvzZKPlQAGBxbla8NdF1ovVqNnH8UvZjYyTuYmpBI!G1OZXDrh3Iv8JTtR0aWu1d7+EhEghgFbMGJp/ASHm44lMQ7nRjUQDpQBW0j9JV4lT+Hxhzc= |
| X-Complaints-To | abuse@giganews.com |
| X-DMCA-Notifications | http://www.giganews.com/info/dmca.html |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 3340 |
| Xref | csiph.com comp.lang.javascript:15707 |
Show key headers only | View raw
On Tue, 04 Sep 2012 23:00:02 +0000, "FAQ server"
<javascript@dotinternet.be> wrote:
>-----------------------------------------------------------------------
>FAQ Topic - What is a function statement?
>-----------------------------------------------------------------------
>
>The term function statement has been widely and wrongly used to
>describe a `FunctionDeclaration`. This is misleading because in ECMAScript,
>a `FunctionDeclaration` is not a Statement; there are places in a program
>where a Statement is permitted but a `FunctionDeclaration` is not. To add
>to this confusion, some implementations, notably Mozillas', provide a
>syntax extension called function statement. This is allowed under
>section 16 of ECMA-262, Editions 3 and 5.
>
>Example of nonstandard function statement:
>
>// Nonstandard syntax, found in GMail source code. DO NOT USE.
>try {
>// FunctionDeclaration not allowed in Block.
>function Fze(b,a){return b.unselectable=a}
>/*...*/
>} catch(e) { _DumpException(e) }
Uh oh. More fixing to do...
>Code that uses function statement has three known interpretations. Some
>implementations process `Fze` as a Statement, in order. Others, including
>JScript, evaluate `Fze` upon entering the execution context that it
>appears in. Yet others, notably DMDScript and default configuration of BESEN,
>throw a `SyntaxError`.
>
>For consistent behavior across implementations, _do not use function
>statement_; use either `FunctionExpression` or `FunctionDeclaration` instead.
>
>Example of `FunctionExpression` (valid):
>
>var Fze;
>try {
>Fze = function(b,a){return b.unselectable=a};
>/*...*/
>} catch(e) { _DumpException(e) }
>
>Example of `FunctionDeclaration` (valid):
>
>// Program code
>function aa(b,a){return b.unselectable=a}
>
><URL: http://jibbering.com/faq/example/functionStatement.html>
><URL: https://mail.mozilla.org/pipermail/es-discuss/2008-February/005314.html>
><URL: http://groups.google.com/group/comp.lang.javascript/msg/aa9a32d0c6ae0342>
><URL: http://groups.google.com/group/comp.lang.javascript/msg/3987eac87ad27966>
><URL: http://nanto.asablo.jp/blog/2005/12/10/172622> (Article in Japanese)
>
>
>The complete comp.lang.javascript FAQ is at
>http://jibbering.com/faq/
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
FAQ Topic - What is a function statement? (2012-09-05) "FAQ server" <javascript@dotinternet.be> - 2012-09-04 23:00 +0000 Re: FAQ Topic - What is a function statement? (2012-09-05) Jim T. <x@y.z> - 2012-09-05 11:09 -0400
csiph-web