Creating immutable arrays in @safe code

Dennis dkorpel at gmail.com
Sat Jul 17 12:56:38 UTC 2021


On Saturday, 17 July 2021 at 12:05:44 UTC, ag0aep6g wrote:
> 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].

I just took the description from the source code:
```D
enum PURE : ubyte
{
     impure      = 0,    // not pure at all
     fwdref      = 1,    // it's pure, but not known which level 
yet
     weak        = 2,    // no mutable globals are read or written
     const_      = 3,    // parameters are values or const
     strong      = 4,    // parameters are values or immutable
}
```
I don't know whether the spec or code is correct.

> Also, conflating other issues with DIP1000 is such an obviously 
> terrible idea.

Yup, [remember 
this](https://github.com/dlang/dmd/pull/8035#discussion_r174771516)?




More information about the Digitalmars-d-learn mailing list