Opportunities for D

Mike via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 8 21:12:48 PDT 2014


On Wednesday, 9 July 2014 at 02:44:54 UTC, Walter Bright wrote:
> On 7/8/2014 6:01 PM, Mike wrote:
>> On Tuesday, 8 July 2014 at 21:22:31 UTC, Walter Bright wrote:
>>
>>> 1. Ref Counting
>>>
>>> I believe that ARC is a pipe dream for D, as we've discussed 
>>> extensively here.
>>> But a ref counted object should work, and would be very 
>>> attractive, much like
>>> C++'s shared_ptr<T>.
>>
>> How does this differ from std.typecons.RefCounted?
>
> Let me put it this way:

My question was sincere, I really wanted to know more about the 
differences  RefCounted and what you proposed.

> users all complain that D doesn't have ref counting. If 
> typecons.RefCounted works, why is this happening?  What can be 
> done to convince people that D does ref counting?

 From what I've observed, I don't think users are complaining that 
D doesn't do ref counting.  I believe they are complaining that D 
doesn't do pervasive automatic reference counting.  RefCounted 
can't be used with D's built-in types, right?

IMO users are complaining that the current mark-and-sweep GC is 
not suitable for certain applications, and they want something 
that is.  The solution that comes to their mind is pervasive ARC, 
so that's what they say they want.  And because they can't 
actually try it for themselves, they aren't convinced it's not a 
feasible solution (It would be nice to see some measurable 
results).

If RefCounted is intended to have shared_ptr<T> semantics, then 
it does appear D does reference counting, but I believe it's 
pervasive automatic reference counting that users really want to 
try.

>  If [std.typecons.RefCounted] doesn't work, what needs to be 
> done to fix it?

RefCounted or any other library solution can't be used with D's 
built-in types, right?  Also, it forces users to change their 
patterns and idioms.  I consider these drawbacks, and don't see 
any solution except to provide an alternative GC implementation.

Mike



More information about the Digitalmars-d mailing list