Some thoughts about C and D, return data through parameters
Nick Treleaven
nick at geany.org
Thu Dec 21 18:12:39 UTC 2017
On Tuesday, 19 December 2017 at 08:54:38 UTC, Petar Kirov
[ZombineDev] wrote:
> Reminds me of C#7's out variable declarations:
> https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#out-variables
>
> However multiple return values are much better implemented
> through language-integrated tuples:
> https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#tuples
In D we don't have tuple unpacking syntax, but if we supported
inline variable declarations for out arguments, we could do it
with a library function:
void unpack(T, A...)(T tuple, out A args);
tuple(4, false).unpack(auto first, auto second);
More information about the Digitalmars-d
mailing list