Accessors, byLine, input ranges

Lutger lutger.blijdestijn at gmail.com
Fri Jan 29 11:43:12 PST 2010


On 01/29/2010 07:01 PM, Andrei Alexandrescu wrote:
...
>> How about @property? When you add a @property to a function it can be
>> called as an assignment. @property does not touch the calling of
>> no-argument functions.
>>
>> Are there any problems with that?
>
> Such a "@property is just for the writing" design will leave @property
> adepts very unhappy, I think. Even I admit that such a rule will be very
> inconsistent, albeit workable.
>
> Andrei


It's not inconsistent, at most just a bit confusing on the call site. 
What @property does is still very clear:
- same syntax as fields for zero and one parameter functions
- function call syntax *not* ok
- mangled differently and recognizable by ide's (think gui programmming 
and ui design tools) and documentation tools. Probably also for 
metaprogramming.

Additionally at the call site you can choose to drop parens for zero 
argument functions, author of those functions has no control over that. 
This feature is now orthogonal to @property and may or may not end up in 
style guidelines. It's also one of those things a smart IDE could help 
you with (did the author really want this to be a property or not?)

I think that solves most of the issues @property was designed for.



More information about the Digitalmars-d mailing list