Replace druntime Hooks with Templates: Milestone 1, Week 2

Teodor Dutu teodor.dutu at gmail.com
Fri Oct 7 08:25:25 UTC 2022


On Monday, 3 October 2022 at 22:28:51 UTC, Johan wrote:
> On Monday, 3 October 2022 at 20:28:19 UTC, Teodor Dutu wrote:
>> Hi,
>>
>> This week I faced a few setbacks with `_d_arraycatnTX` due to 
>> type mismatches.
>> Due to the hustle of moving house, I haven't made much 
>> progress on this front.
>>
>> To take a break from this, I temporarily moved on to the 
>> `_d_newitem{T,iT,U}` hooks.
>> I implemented templated one templated hook for `_d_newitemT` 
>> and added unittests for it.
>> The difference will now be made by the compiler during the 
>> lowering, by calling the constructor, copying the default 
>> initialiser, or doing nothing (`void` initialisation).
>
> Hi Teodor,
>   Are you aware about the capability to override these 
> implementations by the user? DMD itself is using this, see for 
> example: 
> https://github.com/dlang/dmd/blob/16fad687b0e894879564864d7eb75747fb41a057/compiler/src/dmd/root/rmem.d#L257-L262
>
> Is this still possible after your work?
>
> regards,
>   Johan

Hi Johan,

I am aware of this and it will still be possible to override 
these implementations by writing your own `object.d` module, 
which is where they are instantiated from. I will also look into 
the link you gave and update the definitions there to conform to 
the new template.

Thanks,
Teodor


More information about the Digitalmars-d mailing list