On 2011-03-04 08:30:44 -0500, "Steven Schveighoffer" <schvei...@yahoo.com> said:

Note that there is only one (currently) ambiguous case, the case of a getter on an array or a setter on the module. A setter on an array cannot be confused with something else, as well as a getter for the module.

What we need is a syntax to disambiguate. So essentially, we take the most common case, and declare that as the default. But if you define the property this way * then it becomes a property the other way.

Perhaps instead of @property we should have had @getter and @setter. It's shorter to write and easier to disambiguate. It might be too late to change that however.

Another idea someone proposed (I can't find the exact post to give proper credit) would be to allow having a parameter named 'this'. This would allow the creation of non-member functions using the member syntax as with the Uniform Function Call Syntax but without the "Uniform" part: only function specially labeled this way would be eligible to the member call syntax. This would solve our property problem, but is dependent on how UFCS is implemented.

Disallowing global-scope properties isn't very appealing to me. I hear Jonathan's plea that the word "property" means a property *of* something, implying it should be a member, but I think it's hair splitting. D has always allowed properties at global scope, I see no reason to change that only because we used the perhaps-not-totally-appropriate word "property" to name such a concept.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to