www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Issue 6169

Pure functions in D keep producing new and new ideas. There are some
purity-related ideas yet to be implemented, but (I think) accepted by Walter,
like allowing an implicit cast to const of the result of a strongly pure
function, or generating an error if you don't assign the result of a strongly
pure function to a variable. And there is my not so much appreciated idea of
the  transparent too (and maybe there are other ideas I don't remember at the

A new idea has just appeared in Bugzilla, by Timon Gehr:

It asks to allow code like this too, where a pure function calls a impure one
and assigns the result with enum:

int x = 10;
int foo(bool b) {
    if (b)
    return 0;
pure void main() {
    enum y = foo(false);

After thinking some about it, I think it's acceptable. See my comment in the
bug report for more info.

Jun 16 2011