Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Lang.java File Reference


Detailed Description

Defines burst.Lang which contains static utility functions, and defines the global function bu_eval.

Author:
Copyright 2003 Mark D. Anderson (mda@discerning.com)

Licensed under the Academic Free License 1.2 http://www.opensource.org/licenses/academic.php


Namespaces

namespace  burst

Functions

Object bu_eval (String str)
 Evaluate the argument in global scope.


Function Documentation

Object bu_eval String  str  ) 
 

Evaluate the argument in global scope.

If you just inline a call to native eval, then the evaluated string gets your context, including any local variables, and any binding for "this", if you are in an object method. In contrast, the function bu_eval always runs in global scope.

Note that Moz eval() supports a non-standard second scope parameter that could be used to achieve the same thing.

A word about ECMAScript eval(): Until JS1.4, eval is semantically a method on every object, so eval(str) meant this.eval(str). Starting in JS1.4, eval is only a top-level function. Apparently, Mozilla's deprecated window . eval forces a global context, while IE treats window . eval like the global eval keyword. Regardless, the string is evaluated in the current context, so unscoped identifiers are defined at the global level, but local variables are available, including "this". Moz accepts a second scope parameter to eval. SpiderMonkey (but not Rhino) exposes a "Script" builtin object. Script(str).exec.


Generated on Tue Nov 30 04:03:08 2004 for BurstProject by doxygen 1.3.4