TypeFunction example: ImplictConvTargets

Stefan Koch uplink.coder at googlemail.com
Wed Oct 7 00:11:48 UTC 2020


On Wednesday, 7 October 2020 at 00:03:46 UTC, Ola Fosheim Grøstad 
wrote:
> On Tuesday, 6 October 2020 at 23:44:30 UTC, Stefan Koch wrote:
>> Type functions are actually just a shell around operations 
>> that would be illegal in the language as is.
>> But because the type function provides a boundary I can do 
>> these things without invalidating the language semantics.
>>
>> Type functions are something which can be proven to not have 
>> influence on language semantics outside of their own function 
>> bodies.
>
> Ugh, why not do it properly and just add type variables? It is 
> just a pointer... At runtime it could point to the type's RTTI 
> node which contains a pointer to the constructor.

If you know a way to do that cleanly, that does not involve a 
redesign of the compiler,
I am very interested to hear about it.
As things stand type functions are what I can get away with, and 
still be reasonably confident I won't violate language invariants.
Also their syntax blends in fairly nicely with the rest of D.



More information about the Digitalmars-d mailing list