[EMAIL PROTECTED] a écrit :
> Ok, I understand why it was not working. The example I tried was :
>
> js> eval("2+2")
> 2+2
> 4
> js> eval("var t=1+1+1+1")
> var t=1+1+1+1
> js> t
> js: "<stdin>", line 11: uncaught JavaScript runtime exception:
> ReferenceError: "t" is not defined.
>
> I got the argument printed, but the variable t was not defined when
> trying to access it afterwards. But I remembered that eval changes the
> scope (am I right??), then it is logical that the variable t does not
> exist in the current scope.
>
>
> Thanks a lot for your help;)
You're right! I didn't think about this: eval doesn't introduce a new
scope, my "printing eval" does...
If you only need eval to mutate global variables or evaluate an
expression to a value, this "printing eval" will suffice. If not, you'll
need some java.
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino