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

Steven Schveighoffer schveiguy at gmail.com
Sat Oct 8 20:58:09 UTC 2022


On 10/8/22 1:09 PM, FeepingCreature wrote:
> On Friday, 7 October 2022 at 20:04:48 UTC, Steven Schveighoffer wrote:
>> On 10/7/22 3:20 PM, FeepingCreature wrote:
>>>
>>> Yeah, if I could get the associative array to give me a pointer to an 
>>> uninitialized value for a key, that would do it, I think.
>>
>> Have you looked at the implementation for require? That's exactly what 
>> it does.
>>
>> For reference: 
>> https://github.com/dlang/dmd/blob/f4c21ccd6a73fee7abdea39cc38e8c64b627ffe1/druntime/src/object.d#L3457
>>
> 
> Yeah okay so it's definitely possible, but I do feel it's kinda 
> questionable to call barely documented internal implementation-dependent 
> (?) runtime functions from user code...

Perhaps you misunderstand -- I think druntime's `require` should be 
updated to make this work.

-Steve


More information about the Digitalmars-d mailing list