Accessors, byLine, input ranges
Ary Borenszweig
ary at esperanto.org.ar
Fri Jan 29 08:48:10 PST 2010
Andrei Alexandrescu wrote:
> Steven Schveighoffer wrote:
>> On Fri, 29 Jan 2010 11:21:28 -0500, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>
>>> How is f.byLine clearer and less ambiguous than f.byLine()? Or vice
>>> versa for that matter?
>>
>> Note that properties can be named things other than byLine.
>>
>> -Steve
>
> What I meant to say is that in the @property landscape the following two
> conventions become suddenly attractive:
>
> * Do not use @property at all
>
> * Use @property for all nullary functions
>
> And they're bound to save a lot of time to everyone involved.
The first post of this thread was about not invoking a function when you
don't want it to be invoked. bearophile was doing:
auto dg = int function() { ... };
return dg;
but he wanted to return a reference to dg, not the result of invoking
it. One way to prevent that is to never invoke functions unless they are
marked with @property. Or maybe functions defined like that (closures,
whatever) should always require () to be invoked.
If that doesn't sound reasonable, see this:
auto dg1 = int function() { ... };
auto dg2 = dg1;
I'd expect dg2's type to be dg1's type.
Let's just think a solution to this problem first. :-)
More information about the Digitalmars-d
mailing list