On Wed, Jan 7, 2009 at 3:59 AM, Matthias Kramm <[email protected]> wrote:
> I'm currently in the process of writing a compiler for > ActionScript 3.0. > (In case you're interested, the "development snapshot" at > http://www.swftools.org/download.html already contains > a pre-alpha command-line tool, called as3compile(.exe)) > > Now, I'm thinking about adding an "extended mode" to this > compiler, which will support some additional convenience > features which are not currently part of the ECMA spec. The first enhancement I can think of is a language extension called 'properties'. private var _myProperty:int = 0; public function get myProperty():int { return _myProperty; } public function myProperty(value:int):void { _myProperty = value; } This pattern is so common, it could be a language feature. public property myProperty:int = 0; There, much better. You can override the property in a subclass, of course. override public property myProperty:int = 1; Or: override public property myProperty:int { var _myProperty:int = -1; function get ():int { return _myProperty == -1 ? Math.floor(Math.random() * 0x100) : _myProperty; } function set (value:int):void { _myProperty = value; } } Then you can make them read-only, write-only, or read-write. Okay, maybe that's overkill. But I'm tired of having to write 7 lines of code just to add one property to a class. Another one is events. I wish events were part of the interface of an object, and I wish all objects were event dispatchers (i.e. Object and EventDispatcher were one). This is much too advanced to call it a small extension to the language though. There's probably a lot of small things you could pick up from other languages like C, Java, etc. Manish _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

