So what does (inout int = 0) do?

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 16 04:49:21 PDT 2016


On 16/04/2016 12:40, Marc Schütz wrote:
> What are the plans for DIP25's `return` attribute? Because with it, the
> compiler has enough information to know that the return value aliases `s`:
>
> const(T)[] replaceSlice(T)(const(T)[] s return, in T[] slice, in T[]
> replacement);
>
> If the function is passed a mutable `s`, its return value can be
> implicitly convertible to `T[]`.

AIUI, functions don't have to return part of the parameter tagged with 
return, it can return anything.

See:
http://wiki.dlang.org/DIP25#Types_of_Result_vs._Parameters


More information about the Digitalmars-d mailing list