Auto returntype
Andrea Fontana
nospam at example.org
Mon May 20 08:31:14 UTC 2019
On Sunday, 19 May 2019 at 22:57:50 UTC, Alex wrote:
> One thing D does not have in it's type system is the ability to
> infer the return type from the usage:
>
> O[] foo() { O[] x; return x; }
> byte[] q = foo();
>
> The idea is that O is determined to be byte. The compiler looks
> at the assignment and realizes that we want foo to return a
> byte array and that O then must be a byte.
I've just tried a few time. No way to get this idea implemented,
I'm sorry :)
https://forum.dlang.org/thread/ufhibwmouxpivjylqdgm@forum.dlang.org
More information about the Digitalmars-d
mailing list