Syntax ideas for `ref` returning delegate and FP parameters
Dukc
ajieskola at gmail.com
Tue Apr 13 17:09:47 UTC 2021
On Saturday, 10 April 2021 at 14:27:31 UTC, Q. Schroll wrote:
> Currently in D, one cannot directly express that a function
> parameter's type is a delegate or function pointer that returns
> by `ref`. If you write
> ```D
> void f(ref int delegate() dg) { .. }
> ```
> then `dg` will be bound by reference which is probably not what
> the user likely intended. It is equivalent to:
> ```D
> alias DG = int delegate();
> void f(ref DG dg) { .. }
> ```
Question to somebody more familiar with grammar specs: is this
behaviour enforced by the spec, or is it implementation-defined
behaviour?
More information about the Digitalmars-d
mailing list