RFE: Javascript future keywords should generate warnings when used as identifiers



11 years ago
2 years ago


(Reporter: senors, Unassigned)


Firefox Tracking Flags

(Not tracked)




11 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070718 Fedora/ Firefox/
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070718 Fedora/ Firefox/

This is mainly a cross-browser compatibility issue; the JS interpreters Safari 2.x (Mac/Intel), as well as in the 3.0 betas for Windows, die a screaming death (i.e. stop executing) if they encounter a future keyword, e.g. 'abstract' as an identifier.


While that reaction seems extreme to me, it would probably be useful if use of a future keyword generated a warning in the Error console.

I can't get that usage to even come up as a warning in FireFox on any of Mac/Intel, WinXP and Linux i686. 

Reproducible: Always

Steps to Reproduce:
1. use 'abstract' (or any JS 1.5 future keyword) as an identifier in a script
2. open Error Console

Actual Results:  
No errors, warnings, or messages of any sort are generated by the use of the keyword in a (may-someday-be) incorrect fashion.

Expected Results:  
A warning should be visible.

Comment 1

11 years ago
Input: var abstract = 1;

Warning: abstract is a reserved identifier
Source file: javascript: var abstract = 1
Line: 1, Column: 5
Source code:
 var abstract = 1;

You'll need to set javascript.options.strict=true to see that error.
Last Resolved: 11 years ago
Resolution: --- → WORKSFORME

Comment 2

11 years ago
Thanks!  Setting the strictness flag fills the immediate need.  It didn't even occur to me to see if there was a setting for that.

I suppose if there's a lingering idea for an enhancement it would be to have a wider range of configuration options here (e.g. the ability to specifically set future reserved words== warning), but with the changes coming down the pike for 2.0 that seems pretty low priority.



10 years ago
Product: Firefox → Toolkit


2 years ago
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.