static map as a type function

Stefan Koch uplink.coder at googlemail.com
Thu Sep 24 16:40:21 UTC 2020


On Thursday, 24 September 2020 at 16:33:37 UTC, Andrei 
Alexandrescu wrote:
> On 9/24/20 11:59 AM, Stefan Koch wrote:
>> On Thursday, 24 September 2020 at 15:57:03 UTC, Stefan Koch 
>> wrote:
>>> On Thursday, 24 September 2020 at 15:54:55 UTC, Adam D. Ruppe 
>>> wrote:
>>>> On Thursday, 24 September 2020 at 14:36:45 UTC, Stefan Koch 
>>>> wrote:
>>>>> Let me show you the code that does only typeid.name
>>>>
>>>> What if TypeInfo was templated instead of magically 
>>>> generated? So the compiler doesn't need to do all this stuff.
>>>
>>> You still have to instantiate all those templates and do it 
>>> correctly.
>>> Which means the compiler needs some way of exposing all the 
>>> information via the templates system.
>>>
>>> Which essentially requires the same code.
>> 
>> Oh and typeinfo has to be generated eagerly!
>> Whereas the current way it works with ctfe is lazy.
>> Which means as long as nothing else requires typeinfo, using 
>> it at CTFE does not require you to generate it.
>> So code that only uses type info at ctfe does compile with 
>> -betterC.


You still have the problem of spamming the executable with those 
type-info objects.
And you have the problem of having to eagerly generate the entire 
object.
Rather than just having the partial information appear which is 
actually required for the evaluation.



More information about the Digitalmars-d mailing list