tag:blogger.com,1999:blog-5819005.post9043950651107717188..comments2024-03-16T02:17:55.433-07:00Comments on Programming and politics: ActionScript Getters and SettersAnonymoushttp://www.blogger.com/profile/08698131967747444207noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-5819005.post-12223984355463341552013-03-27T13:50:33.253-07:002013-03-27T13:50:33.253-07:00Sadly for me this is no sugar.
Java getter / sette...Sadly for me this is no sugar.<br />Java getter / setters are good.<br />C# properties are good.<br />This is something in between and makes the code looks horrible. I'm not using Actionscript properties.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5819005.post-3854050824493745842010-10-26T07:41:17.235-07:002010-10-26T07:41:17.235-07:00@Борис perhaps because I don't know scala like...@Борис perhaps because I don't know scala like I do AS2, .net and Java, but would your example work when name becomes a property that has code behind it?<br /><br />public function get Name() { return name; } <br /><br />is quite trivial. But when that becomes:<br /><br />public function get Name() { return prefix + internalItem.attributes.name(); }<br /><br />I can not see how your scala example scales to that.dannystaplehttp://squidoo.com/dannystaplenoreply@blogger.comtag:blogger.com,1999:blog-5819005.post-43884228663684630122009-12-19T05:26:27.844-08:002009-12-19T05:26:27.844-08:00Sorry, I don't see any sugars here.
Java's...Sorry, I don't see any sugars here.<br />Java's JavaBeans conventions are as ugly as .NET/AS getters/setters.<br /><br />Compare same things in Scala:<br /><br />trait Person {<br /> def name: String<br /> def name_=(n: String): Unit<br />}<br /><br />class PersonImpl extends Person {<br /> var name = "anonymous" // implements both from above<br />}<br /><br />That's kinda it. To be honest, I've never declared getters and setters in interfaces. I doubt if you ever gain from syntactic sugars if you design your application that way.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5819005.post-54736980785165119642008-07-12T09:26:00.000-07:002008-07-12T09:26:00.000-07:00Wow, thanks! Couldn't find this in the Adobe book...Wow, thanks! Couldn't find this in the Adobe book. I like especially how you can code it as "get property" but access it as "myObj.property". Nice!Anonymousnoreply@blogger.com