Replace druntime Hooks with Templates: Milestone 1, Week 2

max haughton maxhaton at gmail.com
Fri Oct 7 10:57:08 UTC 2022


On Friday, 7 October 2022 at 10:16:25 UTC, Johan wrote:
> On Friday, 7 October 2022 at 08:25:25 UTC, Teodor Dutu wrote:
>> On Monday, 3 October 2022 at 22:28:51 UTC, Johan wrote:
>>>   [...]
>>
>> 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.
>
> Of course you can override anything by writing your own 
> `object.d` module = writing your own druntime. The question is, 
> can the user still override it using the current way. This 
> impacts DMD itself. What DMD wants to override is the memory 
> allocation itself, not necessarily the initialization of the 
> memory. If the templates invoke an `@weak` **non-template** 
> function for allocation, then there is still the possibility of 
> overriding that in user code. Please think about that.
>
> regards,
>   Johan

You can also override the GC using a custom GC class.

The way dmd does memory allocation is quite dumb anyway I don't 
think it would be missed. If needed the GC's collections could 
just be disabled


More information about the Digitalmars-d mailing list