If you could make any changes to D, what would they look like?

Paul Backus snarwin at gmail.com
Fri Oct 29 16:14:35 UTC 2021


On Friday, 29 October 2021 at 16:08:10 UTC, H. S. Teoh wrote:
>> This is not the case with allocation/free, which are, by 
>> defintion, dependend on a global state (even if only thread  
>> local).
>
> Yeah, pureFree makes no sense at all. It's a disaster waiting 
> to happen.

I think the original sin here is allowing GC allocation (`new`, 
`~=`, closures) to be `pure`, for "pragmatic" reasons.

Once you've done that, it's not hard to justify adding 
`pureMalloc` too. And once you have that, why not `pureFree`? 
It's just a little white lie; surely nobody will get hurt.

Of course the end result is that `pure` ends up being basically 
useless for anything beyond linting, and can't be fixed without 
breaking lots of existing code.


More information about the Digitalmars-d mailing list