[haXe] initializing instance variables in declaration

Nicolas Cannasse ncannasse at motion-twin.com
Mon Apr 17 11:03:44 CEST 2006


> I agree that in most cases instant variables are intialized by
> constructor parameters. However, when you extend MovieClip, you're
> pretty much stuck with a parameterless constructor. In such cases, the
> proposed syntax could save some typing -- but then again, in the end
> it's just a bit of sugar :)

The problem is that when extending MovieClip, you might actually
need/want to declare for example :

class MyClip extends MovieClip {
    var _x : Int = -10;
}

Which is not possible since haXe don't allow to redeclare variables.

Nicolas



More information about the Haxe mailing list