@property needed or not needed?
thedeemon
dlang at thedeemon.com
Mon Nov 19 00:45:02 PST 2012
On Monday, 19 November 2012 at 08:23:43 UTC, Jonathan M Davis
wrote:
> On Monday, November 19, 2012 09:16:29 Rob T wrote:
>> My guess is that if @property gets enforced, we'll see a lot of
>> functions with empty parameter lists being defined as @property
>> for the sole reason to get rid of having to type in the ().
>
> Which completely violates the concept of a property in the
> first place. It's
> intended to be an abstraction for a variable. Using @property
> just to get rid
> of parens would be like naming types with verbs instead of
> nouns. It's
> completely backwards.
>
> - Jonathan M Davis
I very much like the combination of UFCS, ranges and parens-free
style which allows writing code like
iota(0, 1000000).map!(to!string).retro.take(50).retro[10].writeln;
So I like Andrei's idea to force @property only for those
functions where it's absolutely necessary to fight ambiguity.
More information about the Digitalmars-d
mailing list