borrowed pointers vs ref
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Fri May 16 09:43:31 PDT 2014
On Thursday, 15 May 2014 at 18:08:06 UTC, Walter Bright wrote:
> get() is returning a pointer to its internally managed data (in
> the form of []). You're right that transitivity of borrowing
> would support this safely, but I am not proposing that for ref.
> To make slicing Buffer safe, one would have to overload opSlice
> and then manage access to the slice.
Sure, I simply question its practical applicability in that case.
It is not like I want borrowed pointer semantics only because it
looks cool :) Transitive borrowing solves certain class of issues
that currently rely on convention, enabling whole new type of
verified safe code (both memory safe and concurrency safe).
Head-only? Doesn't look so.
More information about the Digitalmars-d
mailing list