TypeInfo_Array.value is null

Remi remigillig at gmail.com
Fri Nov 6 08:53:18 UTC 2020


On Thursday, 5 November 2020 at 19:00:43 UTC, kinke wrote:
> On Thursday, 5 November 2020 at 16:48:50 UTC, Remi wrote:
>> I followed how TypeInfo_Array is written in the vanilla 
>> runtime object.d and I was expecting TypeInfo_Array.value to 
>> be set by the compiler but it is null in my case.
>
> Hi, typeid(string) is a built-in TypeInfo in druntime 
> (https://github.com/ldc-developers/druntime/blob/412467a452e2d12f561a2eace933dd44014af3c6/src/rt/util/typeinfo.d#L612), not built by the compiler.
>
>> Is there something I should be doing that I'm not?
>
> By the looks of it, you should probably be using the `next()` 
> method instead of the `value` field directly.

Yeah it's kind of how I worked around it, I just needed `value` 
for `getHash` so I did an override of `getHash` for TypeInfo_Aa 
which worked. It was still surprising as `next()` returns `value` 
for TypeInfo_Array even in the D runtime.


More information about the digitalmars-d-ldc mailing list