https://issues.dlang.org/show_bug.cgi?id=23633
Issue ID: 23633
Summary: allow pure functions to call impure functions passed
as parameters
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Basically, permit this:
```
void foo(void delegate() dg) pure {
dg();
}
```
Similarly to how you can write to values passed through params, if an impure
delegate is passed through params I think we can allow that as an extension of
the weakly pure concept. This would allow things like passing properties to be
set.
If you are passed a class/interface tho, probably should only allow the pure
members since that's not as explicit as the delegates.
I often find myself wanting some kind of limited environment to a function, and
pure ALMOST offers it, but it just isn't able to do enough since pure is too
strict, this kid of relaxation just might make it work.
--