[Issue 17645] `pure` is transitively applied to all delegates inside a pure function

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 17 10:51:34 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17645

--- Comment #7 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Tomer Filiba (weka) from comment #5)
> the fact i *create* a delegate in a pure scope
> shouldn't force the *delegate* to be pure.

I'm not 100% sure about that, but it seems a plausible possibility. As long as
you aren't calling the delegate from within the function (your ASSERT function
seems to be, and assert definitely would be), then just accessing the stack
frame data should be OK.

As far as @nogc goes, that is simply an issue with the functions you need to
call. If you need GC functions within @nogc, then you have to obscure and cast.
I think it's possible to argue that assert should allow GC functionality, but
not 100% sure of that. It appears that any inner functions inside a pure
function are also marked pure. Since there's no "unpure" attribute, it's hard
to undo this.

--


More information about the Digitalmars-d-bugs mailing list