reserved word "package" (in JS)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

reserved word "package" (in JS)

Stefan Krecher
Hi,
while trying to run the repl on a JVM-Rhino-ScriptEngine, i noticed that in the Exporter-class the reserved word "package" was used as a variable name - this throws a org.mozilla.javascript.EvaluatorException - the script can't get executed.
I think "package" should be added to st.reservedWords
regards,
Stefan
Reply | Threaded
Open this post in threaded view
|

Re: reserved word "package" (in JS)

gokr
On 12/06/2011 02:14 PM, Stefan Krecher wrote:
> Hi,
> while trying to run the repl on a JVM-Rhino-ScriptEngine, i noticed that
> in the Exporter-class the reserved word "package" was used as a variable
> name - this throws a org.mozilla.javascript.EvaluatorException - the
> script can't get executed.
> I think "package" should be added to st.reservedWords
> regards,
> Stefan

And after a bit of googling I found this page which seems to be very
detailed on all these issues:

http://mattsnider.com/javascript/reserved-words-in-javascript/

...I still leave it to Nicolas to decide how restrictive we should
really be here.

regards, Göran
Reply | Threaded
Open this post in threaded view
|

Re: reserved word "package" (in JS)

Stefan Krecher
by now i got around this by activating the FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER on the Rhino-Engine
But i guess it could get a problem in the future if scriptengines in browsers are more strict.
The reserved word "package" seems not to be the only problem in amber - at some points the (for future use) reserved word "int" is used as variable name.
regards,
Stefan
Reply | Threaded
Open this post in threaded view
|

Re: reserved word "package" (in JS)

Nicolas Petton
I have no problem with adding 'package' to the reserved words list.
We could follow the MDN
https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words

Cheers,
Nico

On Wed, 2011-12-07 at 03:49 -0800, Stefan Krecher wrote:
> by now i got around this by activating
> the FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER on the Rhino-Engine
> But i guess it could get a problem in the future if scriptengines in
> browsers are more strict.
> The reserved word "package" seems not to be the only problem in amber
> - at some points the (for future use) reserved word "int" is used as
> variable name.
> regards,
> Stefan