new DIP5: Properties 2
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Jul 31 10:11:45 PDT 2009
Steven Schveighoffer wrote:
> On Fri, 31 Jul 2009 12:13:55 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> Maybe we should vote on this too. BTW, seems like the last poll wasn't
>> quite the expected landslide against the dictature :o).
>
> I think the poll might have been skewed due to context (forget my
> newsgroup poll, that was worthy of an abortion, but I also didn't mean
> to submit it :), I'm talking about Ary's)
>
> The question was asked, what do you think this code means. In the
> context of D, where you know a symbol without parentheses can mean
> either a function or a property/field, I'm certain there were several
> respondants who didn't understand it was asking what they think is best,
> not *what D currently does*. Ask that same questions to C++ developers
> and see what you get...
>
> It's hard to phrase the question properly without bias to a group of
> people who already know the current behavior. Maybe something like:
>
> Assume the D programming language required parentheses for normal
> parameter-less functions, and required no parentheses for parameter-less
> functions that returned a property. For example, the following code
> should imply a getter for a filter inside x:
>
> auto tmp = x.filter;
>
> And the following code should imply performing a filtering action using
> x, returning the result:
>
> auto tmp = x.filter();
>
> Do you think it's worth adding such a capability, given that you will
> then no longer be able to call ordinary parameter-less functions without
> parentheses, an author of a property function must properly indicate
> that the function is a property, and the compiler must trust the author
> for this implication?
There's one way to figure it out: Ask away!
Andrei
More information about the Digitalmars-d
mailing list