DIP74 - where is at?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 11 15:24:43 PDT 2015


On Sunday, 11 October 2015 at 22:07:44 UTC, deadalnix wrote:
> That's not true. I explained in this thread why it is too 
> limited, most notably :
>
> 1/ It was barely able to provide a non GC managed array type.
>
> More details here: 
> http://forum.dlang.org/thread/mcg8qq$1mbr$1@digitalmars.com
>
> Notably, it is impossible to reclaim the memory eagerly, but 
> only to clean all memory at once when all reference to one of 
> the memory location is gone. This in turn lead to the need to 
> pretty much have a memory allocator in the array. And jump 
> through many hoops.
>
> 2/ It is completely unable to handle reference types (hence 
> DIP74).
>
> Note that if you don't have indirection, there is no memory 
> allocation problem to begin with as value type will be either 
> on stack or involve some reference at some point.
>
> But this whole thing is really a shift of the burden of proof. 
> What do DIP25 enabled that is really worth it ?

DIP 25 fixes a serious flaw in ref. It makes it possible to 
guarantee that ref is @safe. Without it, ref is not @safe. As I 
understand it, that's the whole point of DIP 25, and it has 
nothing to do with reference counting at all. It doesn't even 
really have anything to do with the heap beyond the fact that a 
ref parameter might refer to an object on the heap - the safety 
problem is with the stack, not the heap.

Walter's proposal in that link does take advantage of the fact 
that DIP 25 restricts what can be returned by ref, but that's as 
close as DIP 25 gets to ref-counting, whereas all of the rest of 
the stuff you're talking about here has to do with ref-counting.

DIP 25 is intended to plug the holes in ref to solve the ref 
safety problem, whereas DIP 74 is intended to build ref-counting 
into the language so that it can be done safely. They both relate 
to @safe code, but as far as I can tell, they're pretty much 
orthogonal, and arguing against flaws in DIP 74 doesn't really 
show flaws in DIP 25. When you're arguing about them together 
rather than separately, it seems like you're seeing some other 
part of the puzzle that I'm not.

- Jonathan M Davis


More information about the Digitalmars-d mailing list