[Laszlo-dev] Detecting classes

P T Withington ptw at pobox.com
Mon Jan 18 05:50:09 PST 2010


On 2010-01-18, at 04:34, Rami Ojares / AMG wrote:

> Below is the debug output.
> At the bottom is the result of clicking one of the "<Pane>" objects in the debugger.
> So from that I draw the following conclusions.
> 
> The argument c (the child) is an object with attributes
> - attrs, children (might be missing), class
> 
> attrs seems to be an object (curly braces)
> children seems to be an array (brackets)
> class seems to be something special ( less-than, greater-than) I would assume this is class (sorry but I don't know exactly what is the distinction between class and object in javascript).

I need to write up more about how the debugger represents objects.  Basically, it tries to print a literal representation that is isomorphic to the actual object.  Javascript is a prototype-based language, and we build classes and instances on top of the prototyping mechanism.  There is no literal representation of an object that has a prototype different from Object.prototype, so the debugger represents such objects in the format <<"type"#"unique id"| "mnemonic name">>.  It will also use this format if an object that does have a literal representation is abbreviated due to being longer than Debug.printLength, or deeper than Debug.printDepth, or contains circular references.  Finally, if you use the format "%#w", the debugger will only use the literal representation if the literal representation will be `==` to the actual object -- any other object will be represented using the detailed <<>> format.

> So far so good.
> The childClass seems to be always something of the form <...> (ie. class)
> Like it was supposed to.
> 
> Then I execute the crucial line
> childClass.prototype is lz.Pane
> 
> But it always returns false...damn.

I think I see the problem.  You must be using swf9/10?  And in that runtime, the test I described will not work.  Hm.  In fact, I'm not sure how you can ask if one Class is a subclass of another Class in AS3.  I'll have to research that!


More information about the Laszlo-dev mailing list