Worst ideas/features in programming languages?

IGotD- nise at nise.com
Fri Oct 15 15:42:13 UTC 2021


On Friday, 15 October 2021 at 14:24:16 UTC, SomeGuy wrote:
>
> This problem could still be solved by making the GC just 
> another allocator (and make it the default global allocator). 
> D's current GC only runs when an allocation is made anyway, so 
> doing this shouldn't break the behavior of existing code 
> (except leaking memory if the constructs that assume GC is 
> used, of course).
>
> Maybe from this point on those constructs can be made to use 
> reference counting instead and make sure they're 
> allocator-independent.

The biggest obstacle is that D has no fat pointers. It has only 
pointers which is enough when you have tracing GC but not enough 
if your pointers requires extra metadata.

This is one of the biggest mistakes in D which limits the 
possibility to change GC type. Other languages like Nim have a 
reference types which is a fat pointer type. Nim has gone through 
more GC types in a shorter time than D.

Fat pointers come at a cost though which might be extra 
dereferences as your data is an inner pointer member. In practice 
this is already possible in D as a library solution. Problem is 
that you cannot easily change Druntime/Phobos to also use your 
custom GC.


More information about the Digitalmars-d mailing list