DIP23 Counter Proposal

Steven Schveighoffer schveiguy at yahoo.com
Thu Feb 7 07:02:41 PST 2013


On Wed, 06 Feb 2013 23:26:03 -0500, Chad Joan <chadjoan at gmail.com> wrote:

> On 02/05/2013 09:45 PM, Steven Schveighoffer wrote:
>> ...
>>
>> The semantic rewrite stuff is something I don't feel strongly either
>> way. It would be nice, but at the same time, it doesn't feel necessary
>> to me. One can always simply avoid it by not using the operators on
>> properties.
>>
>
> A core feature of properties is that variables can be migrated to them  
> (and back) without breaking any of the caller's code.  Forbidding more  
> than half of D's operators on them will definitely break this attribute.

I find this explanation lacking.  A field supports operations that are  
impossible to implement with properties, there will never be a  
non-code-breaking change from a field to a property.  So it's a matter of  
"how much" breakage you want to allow.  This is really a judgment call,  
there is no "right" answer.  The closest you can get to a field is to ref  
an actual field.  But in that case, I don't see the point of the property,  
since you give unfettered access to the field!

The whole point of having properties that I see is to implement things you  
CAN'T implement with a field, or are more cumbersome.  Like read-only  
fields.  Such a change would necessarily and on purpose break code.

-Steve


More information about the Digitalmars-d mailing list