Yes, they should be accessible in complex expressions (evaluated in
the debugger). And yes, it is probably a simple matter of updating
compileAndWriteToSWF. I just think no one ever got around to it. It
would be great if you want to do that.
On 2009-09-27, at 08:49, André Bargull wrote:
So, should it be possible to access these shortcuts anywhere else
than while eval'ing an expression and/or should it be possible to
use them in complex expressions? At least according to the Lisp
reference, it should be possible to use them in complex expressions,
but that's currently only possible in swf8 and dhtml. And only in
swf8, you can access the values globally, but that doesn't seem to
be intended as you said below.
If Compiler#compileAndWriteToSWF() and Compiler#compileAndWriteToAS3
() are changed to include `with (Debug.environment) { ... }`, it
should be possible to use the shortcuts in complex expressions and
avoid polluting the global namespace. These changes seem to be quite
easy or did I miss anything?
On 9/27/2009 1:46 PM, P T Withington wrote:
These are shortcuts that old Lisp hackers know by heart (http://bit.ly/2Ll3qS
), although they have been renamed to be legal Javascript symbols.
This is why we have not felt any need to document them. :)
They are supposed to work in all runtimes. In an attempt to reduce
global namespace pollution, I moved them out of the global
namespace into `Debug.environment` (which is where they more
properly belong -- the Debugger should not be storing its state in
the application's namespace), as is stated in your first
reference. See the note at line 91 of swf9/LzDebug.as. What
really needs to happen is for the swf9 debug evaluator to wrap
`with (Debug.environment) { ... }` around the expressions it
compiles, just as dhtml/LzDebug.js does in `doEval`. I think this
has to happen in the compiler, not the debugger, because of the
other code the compiler wraps around evaluations to heuristicate
whether it is an expression or statement and to report errors.
On 2009-09-27, at 07:06, André Bargull wrote:
The last three results of debugger evals are stored in '_', '__'
and '___' to provide a fast way to access these values again.
Currently, swf8 stores the values in the global object, whereas
AS3 runtimes store the values in the global object "global". This
means in swf8 you could write 'Debug.write("last result was %#w",
_)', but this is currently not possible in swf9/swf10. My
question: Should this be considered as a bug? I don't think there
is any official documentation for these short-hands [1], so maybe
it was only intended that '_' as a single expression should work?!
PS: '_' as a single expression works in swf9/swf10, because that's
a "simple expression" and therefore handled by "evalSimpleExpr"
which calls "globalValue" and "globalValue" looks up values in the
global object "global".
[1] Google only found these two results:
- http://www.openlaszlo.org/pipermail/laszlo-dev/2009-June/021356.html
- http://jira.openlaszlo.org/jira/browse/LPP-630