Thread overview
How to define delegate what returns ref?
Aug 28, 2020
Oleg B
Aug 28, 2020
kinke
Aug 28, 2020
Oleg B
August 28, 2020
Hello all!

syntax

    ref int delegate() foo0;

or

    ref(int) delegate() foo1;

or

    int delegate() ref foo2;

are not valid.

if I try alias

    alias refint = ref int;
    refint delegate() foo3;

foo3 have type `int delegate()` (without `ref`)
and it can't store delegate from object method that have `int delegate() ref` (that can be printed if we use `typeof(&someobject.method).stringof`)

I found only one ugly way to do this

    interface Foo { ref int func(); }
    typeof(&Foo.init.func) foo4;

How to do this more clearly?
August 28, 2020
On Friday, 28 August 2020 at 11:46:15 UTC, Oleg B wrote:
> How to do this more clearly?

alias Dg = ref int delegate();
Dg foo;
August 28, 2020
On Friday, 28 August 2020 at 11:50:35 UTC, kinke wrote:
> On Friday, 28 August 2020 at 11:46:15 UTC, Oleg B wrote:
>> How to do this more clearly?
>
> alias Dg = ref int delegate();
> Dg foo;

Thanks!