Discussion Thread: DIP 1032--Function pointers and Delegate Parameters...--Community Review Round 1
Avrina
avrina12309412342 at gmail.com
Wed Jul 29 02:24:06 UTC 2020
To add onto this, the problem the new proposal would solve is for
example ones with opApply.
import std.stdio;
struct Container {
nothrow @nogc
int opApply(int delegate(int) @nogc nothrow dg) {
return dg(0);
}
}
void main() {
foreach(a ; Container()) {
int* d = new int; // error currently
}
}
Templates aren't exactly a solution, you lose access to auto
inferring the types in foreach if you do.
Where as, in the current state of DIP1032, it is no more than
syntax sugar that introduces a breaking change. I am against
DIP1032 in it's current state adds almost nothing and introduces
breaking changes.
More information about the Digitalmars-d
mailing list