how do you mix ref counted types and non- at nogc algorithms
ikod
geller.garry at gmail.com
Wed Jul 8 19:52:31 UTC 2020
On Wednesday, 8 July 2020 at 16:28:02 UTC, Steven Schveighoffer
wrote:
> On 7/8/20 11:27 AM, Avrina wrote:
>> On Wednesday, 8 July 2020 at 12:30:09 UTC, Steven
>> Schveighoffer wrote:
>>> On 7/8/20 7:26 AM, ikod wrote:
>>>> Hello,
>>>>
>> My understanding to what he means is that a copy of RefCounted
>> will be kept in GC'd memory. So the counter won't hit 0 until
>> the GC collects and calls the destructor for that memory,
>> which isn't guarantee'd to ever happen. Your implementation
>> would have the same problem.
Yes, this is the problem, thanks Avrina!
>
> Oh yeah, I misunderstood the problem.
>
> That's going to be the case no matter what. The only true
> solution would be to use algorithms that use RefCounted instead
> of the GC. Which may be trading one problem for another.
>
I see... Probably this can be configurable option (use GC or RC
for algorithms internals) or can be inferred from the data type
properties (like use RC if data methods used for algorithm are
@nogc). But I'm not sure if this is possible and whether it makes
practical sense.
> -Steve
More information about the Digitalmars-d
mailing list