Properties: a.b.c = 3

davidl davidl at nospam.org
Tue Jul 28 20:13:03 PDT 2009


在 Wed, 29 Jul 2009 10:33:53 +0800,Walter Bright  
<newshound1 at digitalmars.com> 写道:

> The issue is what if b is a property, returns a temporary object, and  
> that temp's .c field is uselessly set to 3?
>
> It's a classic problem with properties that are implemented as functions.
>
> I don't see how C#'s special property syntax adds any value for dealing  
> with this.
>
> One thought I had was to simply disallow the '.' to appear after a  
> function style property.

A property should never return temp obj in the first place.

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list