www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Less pure for objects

reply bearophile <bearophileHUGS lycos.com> writes:
I have done a little experiment, and this code runs:


struct Foo {
    int x;
    pure int bar(int y) {
        return this.x + y;
    }
}
void main() {
    auto f = Foo(10);
    assert(f.bar(7) == 17);
}


So the current D2 implementation works already as in my "half_pure" proposal :o)
I think this can be seen as a bug, but I have not filed it yet.

Bye,
bearophile
Apr 29 2010
parent bearophile <bearophileHUGS lycos.com> writes:
 I think this can be seen as a bug, but I have not filed it yet.

I like it, it's more useful this way, I don't want to file a bug. Bye, bearophile
Apr 29 2010