On Tuesday, January 29, 2013 12:10:04 Steven Schveighoffer wrote: > Sound crazy? Ridiculous? Impossible? Insulting?
It seems like it could work, but without a way to explictly make something a getter property, it will be impossible to change a property function into a variable later without risking breaking code, because then people will still be able to call the property function with parens. Using parens on getter properties has to be illegal for that to work. And if we want it to work to be able to swap a variable for a property function (which is one of the purposes of properties in the first place), not only do we need to improve the property rewriting (which could be done with your scheme), but we'd need to be able to mark a variable in such a way that it couldn't be used for anything which wouldn't work with a property function (e.g. taking its address would have to be illegal), and for that, you'd need an explicit attribute such as @property. So, if we want to be able to swap between variables and property functions during refactoring or design changes or whatnot (as properties are supposed to allow), we're going to need explicit properties of some kind. That could be done with getProp and setProp instead of @property if we really wanted to, but we'd still need a way to mark variables, and for that, you'd probably need an actual attribute like @property. If we go any route other than explicit properties, we're giving up on the possibility of being able to swap variables and property functions without breaking code. - Jonathan M Davis
