DRuntime: Move Functions from `rt/lifetime.d` to `core.lifetime.d` as Templates

RazvanN razvan.nitu1305 at gmail.com
Wed Jun 21 11:52:41 UTC 2023


On Wednesday, 21 June 2023 at 03:54:16 UTC, Teodor Dutu wrote:
> So my approach now is to convert these new templates to "real" 
> templates, that use their template argument instead of 
> `TypeInfo`. This will help use `TypeInfo` less (and hopefully 
> at some point not use it at all in the runtime) but may lead to 
> a lot of template bloating. To reduce this, it's worth noting 
> that `__setArrayAllocLength()` only uses `TypeInfo` to place it 
> at the end of the allocated array. Therefore, the template 
> implementation can be split into a small template (that only 
> handles this part) and a larger non-template function that does 
> everything else (which is common for all types).

1. Can we get rid of putting typeinfo in the array or does the GC 
rely on that?

2. Why is the larger function a non-template? Shouldn't that also 
be a template with no template arguments?


More information about the Digitalmars-d mailing list