Archive for the 'MXMLC WTF' Category

MXMLC WTF (8): Keys can be of any type as long as it’s String

Have you ever tried looping over all the keys in a Dictionary? The whole point of the Dictionary class is that you can have objects of any type as keys, unfortunately someone forgot to tell the ActionScript compiler that:

var dict : Dictionary = ...;

for ( var k : MySpecialType in dict ) { trace(k, dict[k]); }

Error: Implicit coercion of a value of type String to an unrelated type


MXMLC WTF (7): Snooping with verbose stacktraces

The -verbose-stacktraces flag to mxmlc is really useful, but it also has a fun, but disturbing, side effect: you can discover how the person who packaged a swc organized their project. If an error is thrown in a context where the call stack includes methods defined by classes inside a swc the getStackTrace method on Error reveals the location of the .as file as it was when it was compiled.

Read the rest of this entry →

Architectural Atrocities, part 7 / MXMLC WTF (6): Some types are less equal than others

An object of type Number, int, uint and Boolean cannot contain null. You may find it obvious, but I find it weird and disturbing. Disturbing enough to include it in my series on architectural atrocities in ActionScript.

Read the rest of this entry →


Today I discovered yet another reason why properties aren’t such a good idea. When trying to declare the setter of a property internal and the getter public, mxmlc refuses to compile, complaining that there is an ambiguous reference.

Read the rest of this entry →


It’s been reported elsewhere, and even on the MXMLC Ant task page over at Adobe Labs, but I think it’s worth repeating this major WTF:

The MXMLC Ant task doesn’t fail on a build error.

[mxmlc] Tests.mxml(30): Error: Syntax error: A string
        literal must be terminated before the line break.

[mxmlc] this isn't even proper code


Why? Why? Why?


This isn’t strictly a MXMLC WTF, but rather an AS3 WTF, but I’ll stick it here anyway. Look at the following line:

var list : Array = new Array();

This line contains at least three WTF’s. Read on…

Read the rest of this entry →


Error: Method marked override must override another method.

public override function toString( ) : String {

WTF? How can mxmlc not know that Object defines toString?

Hmmm, it seems like you don’t need “override” on methods inherited from Object… oh, how I love those exceptions to the rules.

But whoa? This happens when I remove the “override”:

Error: Call to a possibly undefined method toString through a 
reference with static type net.iconara.logging:LogPattern.

return pattern.toString();

(LogPattern is an interface, the toString method is declared in the class BasicLogPattern, which implements LogPattern)

WTF #2 is that mxmlc doesn’t understand that an interface type is also always of type Object.

mxmlc is probably the most stupid compiler since the ActionScript 2 compiler.

The solution? Why, you have to counter a stupidity with another stupidity:

return (pattern as Object).toString();


I started playing around with the Flex 2 command line compiler, and after an hour or so I finally get it: mxmlc can’t compile properly if the main class is in a package. WTF?

The bug is also described here.

In what world besides examples would you not want your main class to be in a package?