Dunno if you're going to implement [Bindable], which is I guess part of Flex, but if you do...
https://bugs.adobe.com/jira/browse/SDK-14475 and https://bugs.adobe.com/jira/browse/SDK-9804 describe the fact that we can't use data-binding to watch the changes of read-only properties. This ability would allow us to more nicely encapsulate our code while still getting the ease-of-use of data binding. In response to Manish... if you make your public getter and setter contain only pass-throughs to your private variable, why not just make the variable public? Dave On 1/6/09, Manish Jethani <[email protected]> wrote: > > 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 > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

