On 2006-11-16, at 17:05 EST, Max Carlson wrote:
It seems like the compiler is going overboard assuming every 'new
foo()' means make a new Laszlo class called 'foo'. Let me know
what you find!
It's true. The compiler makes no effort to distinguish our
classes from runtime classes. So the runtime classes must be bent
to our way.
I am concerned about us going through and bashing runtime objects
to add a make method... Then again, I suppose the only other
option is to have 'new foo(...)' compile to 'foo.makeClass(...)'
and have makeClass determine if it's an LFC class or not - adding
lots of runtime overhead for each new.
My reasoning exactly. We can change if if global bashing becomes an
issue.
Your decompiler is mistaken about the extent of the `with`,
however. The `with` block extends around the entire expression.
This is intentional, and is to make up for a player bug, where top-
level functions get defined with no context, rather than in their
correct lexical context. It costs nearly nothing to do this and
it makes it so any function can be invoked from an idle task
without the programmer having to make explicit all their global
references. This is not new to Legal's -- it's how we've been
doing it for a while...
I'm glad the decompiler is mistaken! It seems implicit this is
more important for user/LZX code.
I think we should require the LFC to always use this. so we can
drop the extra overhead - with {} is extremely expensive in IE
DHTML...
with(_root) is not for implicit this. I agree, we should do away
with that, but it will be a huge flag day. with(_root) is to get
around a swf player 'feature' where global functions have no
environment attached to them, so they can't find their free
references if invoked from the idle loop.