So how do you create an associative array with an immutable value, anyways?

FeepingCreature feepingcreature at gmail.com
Fri Oct 7 16:11:04 UTC 2022


On Friday, 7 October 2022 at 16:03:49 UTC, Steven Schveighoffer 
wrote:
> On 10/7/22 11:27 AM, FeepingCreature wrote:
>> It's hard to see how you'd make `require` work but not 
>> `assocArray`, since `require` is not exactly a built-in 
>> feature either.
>
> You can either cast (which is reasonable, considering that the 
> assignment only happens when it didn't already exist) or make a 
> new hook.
>
> -Steve

`cast` is not sufficient because `immutable struct S` cannot by 
any means be made mutable.


More information about the Digitalmars-d mailing list