Static member functions
Michal Minich
michal.minich at gmail.com
Wed Dec 9 02:57:00 PST 2009
Hello Denis,
> OTOH, if you want to protect yourself from (accidental) global state
> mutation, you are free to declare your static function as pure:
>
> struct X
> {
> static int x;
> static void foo() pure
> {
> // x = 3; // error
> }
> static void bar()
> {
> x = 3; // okay
> }
> }
I was thinking about providing contract to function, that it does not *modify*
state, something as half-pure. Anyway, this would be hard to define correctly.
More information about the Digitalmars-d
mailing list