An exegesis of Walter's reference counted slice

Ivan Timokhin via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 25 11:04:17 PST 2015


On Wed, Feb 25, 2015 at 08:06:48AM -0800, Andrei Alexandrescu wrote:
> On 2/25/15 1:58 AM, Ivan Timokhin wrote:
> > Oh. So, whenever you pass a reference-counted slice around, you need to do
> > it with the full inc/dec protocol, which, as Walter has mentioned several
> > times already, leads to code bloat and performance hits. So... no to
> > efficient reference counting? Also, no slicing of static arrays in @safe
> > code?
> 
> Correct.
> 
> There's an issue of perception that I just figured, which explains a lot 
> of the drama and trash talk about DIP25.
> 
> DIP25 is not a borrowing mechanism. Its charter is to make reference 
> counted structs (and a variety of other structs) usable in @safe code. 
> As RCSlice shows, with DIP25 a reference counted slice switches from 
> unusable to usable in @safe code by adding one token to an otherwise 
> unchanged implementation. That is Remarkable, and is Good Programming 
> Language Design(tm).
> 
> Borrowing data in a scoped manner is the charter of DIP69. Given the 
> excellent quality of DIP25, it's likely it is Here To Stay and DIP69, or 
> any other proposal for borrowing, will work with it (and probably 
> leverage it).
> 
> 
> Andrei
> 

OK, thank you. I wasn't asking about DIP25 in particular (I think I
understand what it's about), but about your (and Walter's) plans on
the topic in general. I apologise if it sounded offensive in any way.


More information about the Digitalmars-d mailing list