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?