[Greasemonkey] Javascript lexical scoping question

Edward Lee edilee at gmail.com
Fri Apr 15 02:54:22 EDT 2005


On 4/15/05, Jeremy Dunck <jdunck at gmail.com> wrote:
> Don't miss this one:
> http://www.crockford.com/javascript/survey.html

Very good read about javascript. It's quite interesting seeing some
details of the language especially after learning about lexers and
parsers and playing around with grammars.

For those who are just as excited/interested in the grammar as I am..
I found these
Javascript 1.4: http://www.mozilla.org/js/language/grammar14.html
Javascript 2.0:
http://www.mozilla.org/js/language/js20/formal/parser-grammar.html

Does anyone know why this was mentioned in the Statements section?
"The with statement should not be used." I've never used it before
today, but I noticed the javascript shell using it, and I added to it
with more with statements. It's a nice feature but does pretty much
the same thing as assigning a variable to that level. Ex. Instead of
"a.b.c.d.e.x = a.b.c.d.e.y = a.b.c.d.e.z;".. you could do "var tmp =
a.b.c.d.e; tmp.x = tmp.y = tmp.z;" or  "with(a.b.c.d.e) { x = y = z;
}"

-- 
Ed


More information about the Greasemonkey mailing list