Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error: identifier starts immediately after numeric literal

2,686 views
Skip to first unread message

John J Barton

unread,
Nov 6, 2009, 9:06:21 PM11/6/09
to
The first test case (click the "syntax error" button) in
https://getfirebug.com/tests/content/console/testErrors.html
fails on Firefox 3.7. The reason is that the message changed.

The erroneous line is:
<button id="syntaxError" onclick="2BeOrNot2Be(40)">Syntax Error</button>

Before the message was:
Error: missing ; before statement

Now in 3.7:
Error: identifier starts immediately after numeric literal

I can't make sense of either message so I can't figure out if this is a
bug or a feature.

I would understand if the new message was

"2BeOrNot2Be is not an identifier, number, or keyword".

or even

"identifier 'BeOrNot2Be' starts immediately after numeric literal '2'"

of course in the latter case I would say "So, deal with it" since it can
tell them apart.

bug or feature?

jjb

Bob Clary

unread,
Nov 8, 2009, 1:47:07 AM11/8/09
to
On 11/6/09 6:06 PM, John J Barton wrote:
> The first test case (click the "syntax error" button) in
> https://getfirebug.com/tests/content/console/testErrors.html
> fails on Firefox 3.7. The reason is that the message changed.
>
> The erroneous line is:
> <button id="syntaxError" onclick="2BeOrNot2Be(40)">Syntax Error</button>
>
> Before the message was:
> Error: missing ; before statement
>
> Now in 3.7:
> Error: identifier starts immediately after numeric literal

https://bugzilla.mozilla.org/show_bug.cgi?id=523401

John J. Barton

unread,
Nov 8, 2009, 1:01:35 PM11/8/09
to

Compare the quality of the error reporting in the command line tool used
by the javascript engine development team:
---
js> 1for (i in this);
typein:1: SyntaxError: missing ; before statement:
typein:1: 1for (i in this);
typein:1: ^
---
to the error reporting given to our web developers:
---


Error: identifier starts immediately after numeric literal

(no source line, no line number, no column pointer).
---

Also the ECMA standard according to the bug report says:
---
The source character immediately following a NumericLiteral must not be
an IdentifierStart or DecimalDigit.
---
To me this is a much clearer error message. It leads me to look for a
numeric literal and its immediate following character, instead of
focusing my attention on "identifier". Of course if I had the source
line and column of the syntax error I probably would not even need the
message.

jjb

Boris Zbarsky

unread,
Nov 8, 2009, 12:54:23 PM11/8/09
to
John J. Barton wrote:
> Compare the quality of the error reporting in the command line tool used
> by the javascript engine development team:
> ---
> js> 1for (i in this);
> typein:1: SyntaxError: missing ; before statement:
> typein:1: 1for (i in this);
> typein:1: ^
> ---
> to the error reporting given to our web developers:
> ---
> Error: identifier starts immediately after numeric literal
> (no source line, no line number, no column pointer).

That's because your error was in an event handler, where there is no
line/column information (known bug, as you know). Had it been in a
<script> you would have gotten exactly the same information as the js
shell shows there.

-Boris

John J. Barton

unread,
Nov 9, 2009, 11:55:01 AM11/9/09
to

Yes, I do know, but do the people who write the error messages realize
this? If they use the command line, then they are getting a completely
different effect and may not realize how bad their message really is.

jjb

Boris Zbarsky

unread,
Nov 9, 2009, 1:59:40 PM11/9/09
to
On 11/9/09 11:55 AM, John J. Barton wrote:
> Yes, I do know, but do the people who write the error messages realize
> this?

By and large, yes...

-Boris

0 new messages