Jonathan M Davis:

> However, Foo.y is not encapsulated 
> by a strongly pure function at all. Other functions can alter alter it. So, 
> it 
> breaks purity.

Thank you for your explanation :-)

So, let's change the situation a bit. If the struct Foo is the only thing 
present in a module (to avoid someone to touch its private members), and the y 
field is "private static" only foo2 is able to touch it. In this case isn't 
foo2 weakly pure?


struct Foo {
    private static int y;
    static pure void foo2() {
        Foo.y++;
    }
}
void main() {}


Bye,
bearophile

Reply via email to