[Issue 17486] lazy parameters can be used to hijack the pure system
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 9 23:26:26 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17486
--- Comment #4 from Eyal <eyal at weka.io> ---
The solution, clearly is to treat "lazy" is mere syntactic sugar to passing
delegates - thus adding syntactic support for @nogc/etc attribute annotation on
"lazy" parameters - and specifying their attributes just like is done for
delegates.
The assumption that lazy parameters are all pure is wrong (thus this ticket).
The assumption that lazy parameters are all gc/throw is wrong (thus the other
ticket).
It *cannot* be inferred unless lazy parameters make everything a template,
which would be unfortunate. Just like delegate parameter attributes cannot be
inferred - you have to manually specify them or templatize over the delegate
type.
--
More information about the Digitalmars-d-bugs
mailing list