[Issue 4031] Should be able to access const value-type globals from pure functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 3 17:59:45 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4031



--- Comment #3 from bearophile_hugs at eml.cc 2011-07-03 17:54:44 PDT ---
Thank you both for fixing the first thing.

(In reply to comment #1)
> I'm not sure if disabling mutable static variables inside pure functions is
> valid, as some actions on them (eg. returning their address) do make sense.

Returning the address of a static variable defined inside a pure function? I
don't see the purpose of this. It smells.


> They can also be accessed from any statements inside debug {}.

But this need is probably uncommon, and when this needs arises you are able to
move the definition of such variable inside the debug:


pure int foo(int x) {
    debug {
        static int y = 10;
    }
    return x;
}
void main() {}



> Please open a new report for that if you would like it.

Maybe Walter is willing to comment on this, but I think I will open another
report for this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list