__typeid
Bruce Carneal
bcarneal at gmail.com
Sat Aug 1 19:24:58 UTC 2020
On Saturday, 1 August 2020 at 18:26:54 UTC, Andrei Alexandrescu
wrote:
> 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.
That unpleasantness, and the attendant complexities of the
current workarounds, motivates Stefan's type function work. I
agree with beerconf Atila, IIUC, that a good solution to this
will probably involve a generalization to some form of restricted
type variables. Perhaps mutable forms that are canonized to
unique? immutables.
More information about the Digitalmars-d
mailing list