On Friday, 25 January 2013 at 10:56:14 UTC, mist wrote:
On Friday, 25 January 2013 at 05:35:19 UTC, kenji hara wrote:
module abc;
@property int foo(int n);

void main() {
 foo = 1;  // top-level property setter
 1.foo;  // property getter with UFCS
}

We cannot distinguish the two usages without adding any new features.

Kenji Hara

"1.foo" must be compile error here. Makes as much sense as

int a;
void main() {
    1.a;
}

Property must behave exactly like data or it is not a property.

I don't see 1.foo the way you see it. I see it like this:

@property bool is_zero(X value)
{
    return value == 0;
}

void main()
{
    X value;
    value.is_zero;
}

It's just that X happens to be a built-in type, instead of a user-defined type. But I don't see why should that matter.

Reply via email to