__typeid

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Aug 1 18:26:54 UTC 2020


On 8/1/20 1:29 PM, Jacob Carlborg wrote:
> On 2020-08-01 18:12, Andrei Alexandrescu wrote:
>> Progress is moving along nicely with __typeid.
> 
> I recommend __typeid to be private and have the compiler lowering to 
> __traits(getMember, object, "__typeid") to bypass private. This is to 
> make sure this symbol is not accessed directly.

That's related to the matter of immutability. Currently all __typeid 
objects are immutable and live in static read-only storage. That's nice 
and would make it impossible to mess with them. However, that makes them 
very unpleasant to use, e.g. you can't use them as out parameters, can't 
assign them etc. All that old story with tail const.



More information about the Digitalmars-d mailing list