D programming language popularity

IGotD- nise at nise.com
Sun Nov 8 17:00:07 UTC 2020


On Sunday, 8 November 2020 at 15:09:55 UTC, Ola Fosheim Grøstax 
wrote:
>
> Make all raw pointers borrowing, then add owning pointer types. 
> Make all  class pointers work like shared_ptr.
>
> Simple solution: unique_ptr for structs and embedded shared_ptr 
> for classes and dynamic arrays. Owning slices will need a new 
> pointer to the refcount head.

No, then you put restrictions on raw pointers which is something 
we don't need. Forced single ownership is something that does not 
belong in D. Let's just keep the raw pointers as they are and add 
other pointer types instead.

This is something not many languages has thought of which is 
generic pointer types, the ability to mix pointer types in a 
program that are not pre-determined. C++ has its unique_ptr and 
shared_ptr but I was think more in line with A_ptr or B_ptr and 
what those pointers are supposed to use is configurable. This is 
of course possible as library additions but I've never seen 
languages to offer this out of the box and it would be nice to 
have a language framework for this. Nim offers to replace its 
"ref" types with any type of GC. However, why not go a step 
further and allow several types of "ref" types.


More information about the Digitalmars-d mailing list