D programming language popularity

Ola Fosheim Grøstax ola.fosheim.grostad at gmail.com
Sun Nov 8 15:09:55 UTC 2020


On Sunday, 8 November 2020 at 14:04:31 UTC, IGotD- wrote:
> On Sunday, 8 November 2020 at 13:39:17 UTC, Ola Fosheim Grøstad 
> wrote:
>>
>> The problem is that raw C pointers can be owning pointers. So 
>> it would be a breaking change.
>
> We need to break this change because if we don't D will not 
> progress. The alternative is some pointer container as if we 
> would litter C++ std::shared_ptr all over the place, not too 
> happy about that though. This will of course be a library 
> change but I think we should have a language classifier for it. 
> This doesn't really need to be a breaking change but an 
> additional "fat pointer".

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.


More information about the Digitalmars-d mailing list