dip25 implementation
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 6 14:29:07 PDT 2015
On Thursday, 6 August 2015 at 21:16:20 UTC, Steven Schveighoffer
wrote:
> On 8/6/15 4:24 PM, "Per =?UTF-8?B?Tm9yZGzDtnci?=
> <per.nordlow at gmail.com>" wrote:
>> On Tuesday, 4 August 2015 at 20:54:43 UTC, Steven
>> Schveighoffer wrote:
>>> How complete is the dip25 implementation?
>>>
>>> For example, should this be expected to be an error?
>>>
>>> struct S
>>> {
>>> int[5] x;
>>> auto foo() { return x[];}
>>> }
>>
>> You need to (at least) qualify `foo` as @safe.
>
> According to 2.067.0 it was an error without annotating as
> @safe if you use -dip25. I don't understand the "relaxing" of
> it in the latest version, but maybe I'm missing something.
>
> If x was a function local, you don't need to mark foo @safe to
> get an error. I thought dip25 was supposed to make that the
> norm for all data that it could prove was being improperly
> escaped.
Per DIP 25, it's only supposed to apply to @safe code initially:
"For the initial release, the requirement of returns for ref
parameter data to be marked with return will only apply to @safe
functions. The reasons for this are to avoid breaking existing
code, and because it's not yet clear whether this feature will
interfere with valid constructs in a system language."
So, it was a bug in 2.067 if it required anything with -dip25 for
@system or @trusted code.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list