On Sep 6, 2012, at 12:17 PM, Joseph Spencer wrote:
> My apologies on that one. I meant to type the following:
>
> PostfixExpression:
> LeftHandSideExpression [no LineTerminator here] ++
> LeftHandSideExpression [no LineTerminator here] --
>
> PrefixExpression:
> ++ [no LineTerminator here] LeftHandSideExpression
> -- [no LineTerminator here] LeftHandSideExpression
>
> It appears to me that as currently written the following is considered valid
> sytax:
>
> ++++someVar;
>
> I hadn't thought about es3 compatability though, so I could see the reasoning
> in keeping it as is.
> As a noobie (and most likely someone in dire need of correction ;)
> approaching this , it seems to
> me that there are a few loose ends in the grammar. For instance, the
> following statements seem
> allowable by the grammar as currently written:
>
>
> ++typeof someVar;
> ++new Date();
> ++null;
>
> My knowledge is lacking on this though, so I am probably missing something.
> I was surprised
> to find that the following is valid syntax and a perfectly legal
> FunctionDeclaration, but throws a
> ReferenceError when executed:
>
> function failPlease(){
> alert(++++a);
> }
According to the specification, those all should produce runtime ReferenceError
exceptions. However, at least Firefox, reports them as early syntax errors.
Technically, that is out of conformance with the spec.
Based upon that evidence, it would appear that FF implements a grammar that is
closer to you are suggesting rather than what is in the spec. In either case
there is an error, but the FF implementation prevents the entire Program unit
from running.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss