Store mutable indirections in immutable data with this one weird trick!
tsbockman
thomas.bockman at gmail.com
Sat Nov 13 09:06:23 UTC 2021
On Saturday, 13 November 2021 at 08:32:42 UTC, Timon Gehr wrote:
> On 13.11.21 09:30, tsbockman wrote:
>>>
>>
>> That's a compiler bug.
>
> Nonsense. Results of strongly pure function calls implicitly
> convert to immutable. Your "fix" just avoided purity inference.
I see. This does not appear to be documented anywhere in the spec
at the moment.
I found definitions for "strongly pure" and "pure factory
function", but nothing about exceptions to the normal implicit
conversion rules. After being defined, the latter term is never
used again in the spec.
There is also no mention of this in the "Creating Immutable Data"
section:
https://dlang.org/spec/const3.html#creating_immutable_data
More information about the Digitalmars-d
mailing list