Nick Sabalausky wrote: > "Chad J" <chadj...@__spam.is.bad__gmail.com> wrote in message > news:[email protected]... >> Have you checked out haXe's syntax for properties? >> http://haxe.org/ref/properties >> > > Yes, in fact, I've been using haxe a lot lately for work. It certainly beats > AS2 and PHP, but there's still a lot about it I really dislike, and it's > property syntax is one of my biggest complaints. > > For those not familiar with haxe, compare the following property in my > current D proposal, the equivilent C#, and the equivilent haxe: > > -------------------------------- > // D, current DIP4 > public int foo > { > get { return value; } > set { value = set; } > } > -------------------------------- > // C# > private int _foo; > public int foo > { > get { return _foo; } > set { _foo = value; } > } > -------------------------------- > // Haxe > public foo(get_foo,set_foo):Int; > private _foo:Int; > private get_foo():Int { return _foo; } > private set_foo(value:Int):Int { _foo = value; return value; } > -------------------------------- > > That's absolutely horrific for anyone who even remotely values DRY and > readability (and formatting the the getters/setters on multiple lines > doesn't help). There are a bunch of problems with it, but the one that > really sticks out to me is: why in the world should I have to specify > special getter/setter names for every single property? What in the world is > the point of that? That's like being expected to specify a special name for > every 'if' block in the program. I don't want or need a special name, just > give me a damn if/getter/setter/whatever! > >
Good point.
