byKey and byValue: properties or methods?

bearophile bearophileHUGS at lycos.com
Tue Jan 17 16:31:25 PST 2012


Nick Sabalausky:

> Without properties, member function access *ANY* many value 
> accesses are "a.b()". Is this member value a plain-old-var or a function? 
> Who knows! It's a leeked out implementation detail, hooray!

I have a partially related question.

Currently this code compiles even with -property:

void main() {
    int[int] aa = [1:2];
    auto byval = aa.byValue();
}

But I think byValue is a property, so isn't it right to give a compilation error if you add () after the name of a property?

-----------------

By the way, I have just seen this code gives a Access Violation, I think it's a bug for Bugzilla:

void main() {
    int[int] aa;
    auto byval = aa.byValue();
}

Bye,
bearophile


More information about the Digitalmars-d mailing list