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

Johannes Pfau nospam at example.com
Fri Jan 25 12:28:34 PST 2013


Am Fri, 25 Jan 2013 12:12:55 -0800
schrieb "H. S. Teoh" <hsteoh at quickfur.ath.cx>:

> 
> 
> >	struct Type
> >	{
> >	    @property void native(int);
> >	}
> 
> This should behave as though you wrote this:
> 
> 	struct Type
> 	{
> 	    // const because there is no setter
> 	    const int native;
> 	}

Only if the getter is marked as const. We can discuss if that should be
required, but in the code above, native isn't necessarily const.

> 
> All of the confusing/unclear/ambiguous cases come from an incomplete
> implementation of @property and an unnecessary conflation with normal
> functions. A @property function should not be treated like a normal
> function. It turns the function into a variable-like entity that *no
> longer acts like a function to the outsider*. Neither should normal
> functions for whatever strange reasoning be conflated with @property
> functions, because functions are not variables.
> 
Please add you proposed changes to Proposal 1 in this wiki page or add
another proposal to it:
http://wiki.dlang.org/Property_Discussion_Wrap-up


More information about the Digitalmars-d mailing list