Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #27748

Re: ! function

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: ! function
Date Tue, 19 May 2015 01:39:57 +0200
Organization solani.org
Lines 38
Message-ID <555A784D.5050700@arcor.de> (permalink)
References <ddSdncub_tOuptbInZ2dnUVZ8gidnZ2d@westnet.com.au> <mig09m$not$1@speranza.aioe.org> <XnsA493D6D7F9E67eejj99@194.109.133.246> <migej4$beq$1@solani.org> <XnsA493E3574B657eejj99@194.109.133.246> <f2a00d8a-1045-45f5-b5cb-95aeaca3b984@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace solani.org 1431992394 28199 eJwFwQEBwCAMAzBLg9O1yBnj9S+BBF+ObK5ELhju4+HiPKXaJW/R67bjhxmTSd0bkJIjWng4nxFO (18 May 2015 23:39:54 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 18 May 2015 23:39:54 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
To Scott Sauyet <scott.sauyet@gmail.com>
X-User-ID eJwFwYEBgDAIA7CXBGkL5wwm/59ggpfGURAMLLYdx5zWvYZAayoyVKxPwn38KMX0+Tanb/0LqxC9
In-Reply-To <f2a00d8a-1045-45f5-b5cb-95aeaca3b984@googlegroups.com>
Cancel-Lock sha1:MklHpJLxKhEKeVtmKrBO6ETAXlQ=
X-NNTP-Posting-Host eJwFwYEBwCAIA7CXhtCi50i3/n/CEiSD6iJYMLwk91iZonJxT9c6vNAlfXY8MYwG03i/wg8jFxDc
Xref csiph.com comp.lang.javascript:27748

Show key headers only | View raw


Scott Sauyet wrote:

> Evertjan. wrote:
>
>> Christoph M. Becker wrote 
>>
>>> That's wrong.  According to ES 5.1 the line can't be parsed as
>>> FunctionDeclaration, because the Identifier is missing.  Actually, the
>>> code doesn't match any production, and as such is syntactically invalid.
>>
>> Quite, but that doesn't explain why
>>
>> !function(a){alert(a)}('ho');
>> +function(a){alert(a)}('ho');
>> -function(a){alert(a)}('ho');
>>
>> ... do not throw an error.
>>
>> "syntactically invalid" is just "according to the rules",
>> "throwing an error" is what should concern us in practice.
> 
> Ok, so we'll try to simplify a bit:

<snipped the story of Parry Parser and his colleagues>

A wonderful story – thanks for telling, Scott.  And a really fine
explanation of the interaction of parsers and scanners (aka
lexers/tokenizers).

Actually, I would like to see the story in a FAQ note.  Maybe chapter 4,
Function, should be augmented by a section about "Why is there an
operator before `function`?" (or similar), which explains the issue
shortly, and links to the full story.

Thoughts?

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

! function Andrew Poulos <ap_prog@hotmail.com> - 2015-05-07 20:15 +1000
  Re: ! function "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-07 13:04 +0200
  Re: ! function "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-05-07 05:02 -0700
  Re: ! function Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-05-07 12:27 -0300
    Re: ! function JJ <jj4public@vfemail.net> - 2015-05-08 00:09 +0700
    Re: ! function "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-07 21:07 +0200
      Re: ! function "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-05-07 21:31 +0200
        Re: ! function "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-07 22:20 +0200
          Re: ! function "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-05-07 23:27 +0200
            Re: ! function "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-05-08 00:26 +0200
              Re: ! function "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-08 11:00 +0200
                Re: ! function James Lewis <lewisje@gmail.com> - 2015-06-05 09:10 -0700
          Re: ! function Scott Sauyet <scott.sauyet@gmail.com> - 2015-05-18 13:31 -0700
            Re: ! function "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-05-19 01:39 +0200
              Re: ! function Scott Sauyet <scott.sauyet@gmail.com> - 2015-05-19 05:48 -0700
        Re: ! function Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-05-07 17:47 -0300
          Re: ! function "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-07 23:22 +0200
            Re: ! function Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-05-07 19:08 -0300
              Re: ! function "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-08 12:08 +0200

csiph-web