DIP 1028 dub packages test package "sml"
Jon Degenhardt
jond at noreply.com
Sun Jan 5 01:39:34 UTC 2020
On Sunday, 5 January 2020 at 01:13:14 UTC, Jon Degenhardt wrote:
> On Sunday, 5 January 2020 at 00:34:42 UTC, ag0aep6g wrote:
>> With DIP 1000, that should work. But it looks like std.getopt
>> needs a little push.
>>
>> An attempt: https://github.com/dlang/phobos/pull/7344
>
> Thanks for taking a look at this.
>
> Does this mean DIP 1000 modifies the rule against taking the
> address of local variables in @safe functions? I did not
> realize this. Is there documentation somewhere describing the
> DIP 1000 rules for @safe functions? It's hard to tell from the
> DIP 1000 doc, and the rationale for "Superseded" status
> indicates that the implementation doesn't match the text of the
> DIP.
Looking more closely at DIP 1000 doc - It appears to be saying
that the compiler will try to prove addresses taken of local
variable cannot be escaped. If the compiler can prove this, the
function will pass @safe even it the address of locals is taken.
If the compiler cannot prove it, the code will need to be
rewritten to pass @safe.
So no hard rules about taking the address of local variables or
not. Developers need to try it and see. Is this a reasonable
summary?
More information about the Digitalmars-d
mailing list