[core.reflect] TemplateInstance reflection

Stefan Koch uplink.coder at googlemail.com
Mon Oct 4 07:26:30 UTC 2021


On Monday, 4 October 2021 at 04:40:37 UTC, Elronnd wrote:
> On Thursday, 30 September 2021 at 22:19:33 UTC, Stefan Koch 
> wrote:
>> preliminary tests show that the reflection data-creation 
>> scales linearly
>
> I feel like all I ever do when you show off your incredible 
> work on core.reflect or newctfe is propose completely 
> impractical changes.  Well, let me propose another one :)
>
> Have you considered using the same in-memory layout for the 
> compiler's own structures as for the core.reflect ones, so it's 
> not linear-time but constant-time?

I am not sure what you mean with impractical changes.
It's true that newCTFE turned out to be much bigger in scope and 
required work than anticipated.
Whereas core.reflect is actually manageable.
I have considered just exposing the compiler internal 
data-structures directly.
But that would be completely unmaintainable as the ABI would 
break on nearly every compiler release.
The reason core.reflect uses it's own class hierarchy is to have 
a buffer between what is exposed to the user and the compiler 
internals.
Such that there is at least the possibility of changing one 
without having to change the other at the same time.



More information about the Digitalmars-d mailing list