Syntax ideas for `ref` returning delegate and FP parameters

MoonlightSentinel moonlightsentinel at disroot.org
Sat Apr 10 21:25:07 UTC 2021


On Saturday, 10 April 2021 at 14:27:31 UTC, Q. Schroll wrote:
> A third one that is a little obscure is allowing `ref(int)` as 
> a syntax for delegate and function pointer return types. Then 
> it would be akin to `const int* method()` being different from 
> `const(int*) method()`.

That's the best option IMO because it adapts a well known pattern.

> Do you guys have any better ideas? I don't really like mine.

Maybe allow `ref` as a postfix?

```d
void foo(int ref delegate() dg) {}
```

Allthough that looks kinda weird.


More information about the Digitalmars-d mailing list