On Saturday, 16 April 2016 at 11:49:21 UTC, Nick Treleaven wrote:
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

I'm not sure. That section says that the situation may change in the future. Other parts of the DIP can be read both ways, but it doesn't mention aliasing explicitly. As this is currently still experimental and not a complete design anyway, we can change it to fit our needs.

Reply via email to