Challenge: write a reference counted slice that works as much as possible like a built-in slice

Adam Ruppe destructionator at gmail.com
Mon Nov 8 22:07:46 UTC 2021


On Monday, 8 November 2021 at 21:42:12 UTC, Andrei Alexandrescu 
wrote:
> - work with qualifiers like T[] does, both RCSlice!(qual T) and 
> qual(RCSlice!T)

I think this is an incorrect requirement. A const(T) is now 
allowed to increase a reference count by definition.

It in theory might still allow borrowing a reference, since 
there'd be no net change in reference count there and thus the 
data can remain immutable, but if isn't statically guaranteed to 
be balanced, you're directly in contradiction with the const rule.


More information about the Digitalmars-d mailing list