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

Elronnd elronnd at
Tue Dec 14 06:27:27 UTC 2021

On Friday, 12 November 2021 at 21:14:28 UTC, Timon Gehr wrote:
> You still need language support. Reaching mutable data through 
> an immutable pointer violates transitivity assumptions.

D does not have well-defined provenance semantics.  We need to 

1) what provenance semantics do we want;

2) how do we implement those provenance semantics; and

3) how do we implement rc given those semantics

Ideally 1 should be decided with an eye towards 2 and 3.  I think 
it would be reasonable to define provenance semantics which 
permit you to derive a mutable pointer from an immutable one 
(though not in @safe code).  I think it would also be reasonable 
to define provenance semantics under which you cannot perform 
such a derivation.

But that's something we have to decide, not take for granted.

More information about the Digitalmars-d mailing list