Creating immutable arrays in @safe code
ag0aep6g
anonymous at example.com
Sat Jul 17 12:05:44 UTC 2021
On 17.07.21 13:05, Dennis wrote:
> There used to be a complex `isReturnIsolated` check, but the [fix for
> issue 15660](https://github.com/dlang/dmd/pull/8048) reduced it to a
> check 'is the function strongly `pure`' which means 'parameters are
> values or immutable'. To reduce code breakage, the 'strong pure'
> requirement is only needed with -dip1000, which is why your example
> doesn't work with it.
Hm, as far as I understand, "strongly pure" doesn't require `immutable`
parameters. `const` should be enough. The spec says: "A strongly pure
function has no parameters with mutable indirections" [1]. Seems to me
that the fix is buggy.
Also, conflating other issues with DIP1000 is such an obviously terrible
idea.
[1] https://dlang.org/spec/function.html#pure-functions
More information about the Digitalmars-d-learn
mailing list