Feedback Thread: DIP 1032--Function pointers and Delegate Parameters...--Community Review Round 1
Steven Schveighoffer
schveiguy at gmail.com
Fri Apr 3 14:01:52 UTC 2020
On 4/3/20 9:08 AM, Steven Schveighoffer wrote:
> T foo(T)(T delegate() dg, T function()) { return dg() + fp(); }
I should clarify this.
Since the delegates are provided not as template parameters but with a
templated return value, the attributes can be inferred as normal. So
this actually isn't an issue.
It's more when the template doesn't actually call the delegate or
function, e.g.:
struct S(T)
{
T delegate() _dg;
void foo(T delegate() dg) { _dg = dg; }
}
foo can be inferred as @safe, @nogc, nothrow, pure. What happens to dg?
-Steve
More information about the Digitalmars-d
mailing list