D does have head const (but maybe it shouldn't)

John Colvin john.loughran.colvin at gmail.com
Wed Dec 30 20:59:17 UTC 2020


On Wednesday, 30 December 2020 at 20:33:34 UTC, Max Haughton 
wrote:
> On Tuesday, 29 December 2020 at 20:47:10 UTC, John Colvin wrote:
>> On Tuesday, 29 December 2020 at 19:42:28 UTC, John Colvin 
>> wrote:
>>> [...]
>>
>> It's so head-const that I made the beginnings of a friendly 
>> 100% @safe head-const with it. Please don't use it.
>>
>> [...]
>
> Isn't there already Final in experimental typecons?
>
> I think with any method like this you are slightly at the mercy 
> of the ABI for structs but I haven't been bitten yet.


It's perfectly ok to create a type that is un-reassignable like 
std.experimental.typecons.Final. What makes my code evil is it 
actually carrying the type-qualifier.


More information about the Digitalmars-d mailing list