[Dlang-internal] DIP1000 discussion and testing
Walter Bright via Dlang-internal
dlang-internal at puremagic.com
Sat Oct 22 00:57:47 PDT 2016
On 10/21/2016 3:21 AM, Martin Nowak wrote:
> On Friday, 21 October 2016 at 06:04:41 UTC, Walter Bright wrote:
>> 3. The design utterly relies on a 'ref' value not being returned as a '*'. Any
>> attempts to circumvent this will lose the checking. The rationale for this is
>> a dramatic simplification of the design.
>
> DIP1000 mentions that disallowing &var in @safe code is overly restrictive. This
> got me fairly confused, please help to clarify
> https://github.com/dlang/DIPs/blob/731255ed7dc37d596fec0552013f0e12c68f7bea/DIPs/DIP1000.md#escaping-via-return
> or my understanding of it.
>
In order to simplify the text, I used &t as an example, even though @safe code
doesn't allow taking the address of a local. But, this is allowed:
int[10] sa;
int[] da = sa[];
and is the semantic equivalent of taking the address of a local. But I didn't
want to confuse things by introducing arrays, I wanted to be reductionist as
much as possible.
But the examples in the PR tests use the arrays.
More information about the Dlang-internal
mailing list