From: Dr J R Stockton on 25 May 2010 16:22 In comp.lang.javascript message <htdar8$46t$1(a)news.eternal- september.org>, Mon, 24 May 2010 00:45:43, Garrett Smith <dhtmlkitchen(a)gmail.com> posted: >On 5/23/2010 4:00 PM, FAQ server wrote: >> ----------------------------------------------------------------------- >> FAQ Topic - What is a function statement? That is not a Frequently Asked Question; nothing like it. >New FAQ Topic idea: > >| What is a FunctionDeclaration? Likewise. If you want to write pedantic tutorial material, or a Glossary and/or Interpretation for ECMA 262, then you should do it on a Web site of your own, or bury it among the Notes. -- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME. Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links. Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7) Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)
From: John G Harris on 26 May 2010 11:24 On Tue, 25 May 2010 at 09:08:37, in comp.lang.javascript, Ry Nohryb wrote: >On May 25, 4:49�pm, John G Harris <j...(a)nospam.demon.co.uk> wrote: >> On Mon, 24 May 2010 at 13:33:59, in comp.lang.javascript, Garrett Smith >> >> >How about: >> >| in ECMAScript a FunctionDeclaration is not a Statement; it cannot >> >| appear everywhere that a Statement can. >> >> Also completely accurate and true, and better. > >If you mean a statement, as in : A.4 Statements: Gawd, you can't even copy-and-paste accurately! It's Statement, singular. >Block >VariableStatement EmptyStatement ExpressionStatement IfStatement >IterationStatement ContinueStatement BreakStatement ReturnStatement >WithStatement LabelledStatement SwitchStatement ThrowStatement >TryStatement, > >I'm not sure. What would be an example ? A piece of code with a spot >in which you could put any statement but not a function declaration ? Surely you've seen this : do Statement while ( Expression ); Inside a 'do' statement you must put another Statement (exactly one). You mustn't put a FunctionDeclaration there. John -- John Harris
From: John G Harris on 26 May 2010 11:36 On Tue, 25 May 2010 at 10:54:31, in comp.lang.javascript, Garrett Smith wrote: >On 5/25/2010 9:35 AM, Johannes Baagoe wrote: >> Garrett Smith : >> >>> How about: >>> | in ECMAScript a FunctionDeclaration is not a Statement; it cannot >>> | appear everywhere that a Statement can. >> >> English is not my mother tongue, but I choke on "everywhere that", plain >> "everywhere" would seem to be enough. >> >> I also fear a logical ambiguity. Does it mean "There is at least one place >> in which a Statement can appear and a FunctionDeclaration cannot", or >> "Everywhere a Statement can appear, a FunctionDeclaration cannot"? >> > >| in ECMAScript a FunctionDeclaration is not a Statement; there are >| places where a Statement may appear and a FunctionDeclaration may not. <snip> Unfortunately, 'may' is a dangerous word to use in a specification or similar. You may not walk on the grass meaning it is forbidden. It may not rain today meaning it is a possibility. I first saw this in a hardware interface spec which said At this time, parity may not be correct. Guess which meaning was intended :-) Let's have another go at it : "in ECMAScript a FunctionDeclaration is not a Statement; there are places in a program where a Statement is permitted but a FunctionDeclaration is not." John -- John Harris
From: Ry Nohryb on 26 May 2010 12:18 On May 26, 5:24 pm, John G Harris <j...(a)nospam.demon.co.uk> wrote: > > Gawd, you can't even copy-and-paste accurately! It's Statement, > singular. Either that or that you can't read, Johnny: ES3 specs, page 162: "A.4 Statements" > (...) > > Surely you've seen this : > > do Statement while ( Expression ); > > Inside a 'do' statement you must put another Statement (exactly one). > You mustn't put a FunctionDeclaration there. You can do it and it's not an error, see: http://groups.google.com/group/comp.lang.javascript/msg/a8bf14d724e82d77 sooo, could you please post a example that proves your (and Garrett's) point, *please* ? TIA, -- Jorge.
From: Ry Nohryb on 26 May 2010 12:19
On May 26, 5:36 pm, John G Harris <j...(a)nospam.demon.co.uk> wrote: > > Let's have another go at it : > > "in ECMAScript a FunctionDeclaration is not a Statement; there are > places in a program where a Statement is permitted but a > FunctionDeclaration is not." Keep trying. -- Jorge. |