[Dlang-internal] DIP1000 discussion and testing
Walter Bright via Dlang-internal
dlang-internal at puremagic.com
Fri Dec 9 21:00:42 PST 2016
On 11/22/2016 6:09 AM, Martin Nowak wrote:
> - what about unwanted/incorrect return scope inference
>
> Mixed return branches would conservatively assume a scoped return value?
> Is this a valid use-case? Should at least work with @system code.
>
> int* func()(int* arg, bool allocate)
> {
> return allocate ? new int : arg;
> }
?: returns the most restrictive scope of any of its operands. This applies
equally as well to a function with numerous parameters that are return scope or
return ref.
> - what about return ref without scope
>
> Does return ref on parameters makes sense without scope?
Yes, see dip25.
> Can you take the address of an unscoped return ref result?
Taking the address of a ref makes it a scope.
More information about the Dlang-internal
mailing list