property syntax strawman

KennyTM~ kennytm at gmail.com
Sun Aug 2 03:36:48 PDT 2009


Frank Benoit wrote:
> Walter Bright schrieb:
>> Zhenyu Zhou wrote:
>>> Walter Bright Wrote:
>>>> but oops! That defines a field. So we came up with essentially a hack:
>>>>
>>>>    bool empty{}
>>> weird syntax
>> I agree, it's a wart.
>>
>>
>>> I'd rather use
>>>    bool empty=() { ... }
>>>    void empty=(bool b) { ... }
>> I suggested that, but Andrei thought it looked unintuitive, and he has a
>> point.
> 
> Or how about making it a single method?
> 
> bool empty=(bool* value){
> 	if( value ) _empty = *value;
> 	return _empty;
> }
> 
> The compiler rewrites the calling code to either pass the address or null.

So properties can't be used in SafeD?



More information about the Digitalmars-d mailing list