http://d.puremagic.com/issues/show_bug.cgi?id=8905



--- Comment #3 from monarchdo...@gmail.com 2012-10-30 01:44:41 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > I don't think there is *ANY* way to ever make this work, and I'd suggest 
> > either
> > of:
> > *Re-writing the documentation.
> > *Removing the function if the documentation is correct.
> > 
> 
> I don't think so, either, and I agree with the recommendation.

Wait, thinking about it, technically, it could actually work, if the original
range then produced :"[1, 2, 3, 4, 7]".

The thing is that such semantics are un-natural. It would correspond to my
notion of "a Dlist is just a view into a chain of nodes". The problem is that I
*still* don't know if that would be the intended behavior...

BTW, here is a fun bug related to said "view of chain" behavior:

//----
import std.container;
import std.stdio;

void main()
{
    auto list = make!(DList!int)(1,2,3,4,5);
    auto r = list[];
    list.stableRemoveBack();
    list.stableRemoveFront();
    list.stableRemove(list[]);
    writeln("My empty list: ", list[]);
    writeln("My original slice: ", r);
}
//----
My empty list: [2, 3, 4]
My original slice: [1, 5]
//----

Fixing this is doable, but it makes the implementation *very* complicated
(standard dlist assumptions don't hold anymore). Not to mention it allows for
some *very* weird semantics. Not worth it, IMO.

I'd have suggested that DList be changed to have a simpler reference semantic
(all Dlist share a common payload), with explicit destruction of removed nodes
(and invalidation of ranges that index them). EG: The DList we all know and
love...

But seeing how much feedback I've received, I'm not sure I feel like pushing
for this one >:(

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to