@property - take it behind the woodshed and shoot it?

Jonathan M Davis jmdavisProg at gmx.com
Fri Jan 25 01:07:46 PST 2013


On Friday, January 25, 2013 09:49:00 eles wrote:
> On Friday, 25 January 2013 at 07:14:19 UTC, Jonathan M Davis
> 
> wrote:
> > On Friday, January 25, 2013 07:47:27 eles wrote:
> >> On Friday, 25 January 2013 at 04:21:07 UTC, Jonathan M Davis
> > 
> > However, even if we're stuck with parenless function calls
> > being legal, we can
> > still have @property function like it does in C# and require
> > that it be used
> > without parens.
> 
> I think the root reason of this fight over what properties are
> and how are used/usable boils down to the way they are deined in
> D over C#:
> 
> 1. in D they are defined as functions (or very similarily to
> those), so many people are perceiving them as FUNCTIONS to which
> one tries to stick some variable-like calls
> 
> 2. in C# they are deined as VARIABLES WITH ACCESSORS, so many
> people tend to see those as some variables with some extra.
> 
> IMHO the chosen syntax for defining properties matters in the
> first place.
> 
> I do not dear to suggest implementing a more variable-like syntax
> (like the one in C#), but at least decide once for all which side
> of the barricade we wand D's properties to be.

I think that C#'s syntax (or something close to it) probably would have been 
better, but it's too late now. But a lot of the problem stems from the fact 
that the original way that properties were implemented in D was essentially 
what Walter is proposing now, and I believe that the fact that that worked 
originally was at least partially by accident. So, it's pretty much always 
been the case in D that properties were implemented via functions, and any 
change to a syntax similar to C#'s would have been a big change (much as it 
probably would have been a good idea).

- Jonathan M Davis


More information about the Digitalmars-d mailing list