-
-
Notifications
You must be signed in to change notification settings - Fork 740
Fixes & docs for DList #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(I recommend squashing all those white space changes into one commit if possible.)
|
Thanks you for the re-read. Yes, I'll squash, but I can't do it from this current computer. I'll also reword the commit message. |
Anyone else want to have a look at this? |
Ranges such as Also added documentation about what to expect from linearRemove (which was just documented as EDIT: No new tests for |
Documents the exact behavior of DList. Addresses all issues in: http://forum.dlang.org/thread/gjhclwsuqyhrimdeoaec@forum.dlang.org and http://d.puremagic.com/issues/show_bug.cgi?id=8905 Also: Unittests. Also: OpOpAssign
unittests already existed
Any other pending changes or is this good to merge? Also, slightly related since you're poking around in |
I don't think I have anything else to add on my end, pertaining to this change.
Quick answer: |
Okay, LGTM. It's a bit annoying that we can't sanely avoid the GC for |
This is all assuming we keep the "chain" mechanic we have going on here. It is the way it currently works, but I'm not even sure it was intended to work this way... I think the original author just didn't really think through what would happen if several DLists aliased the same content... I merely patched a few holes I found because of this. The current mechanic is un-natural: DList is both container and range (range in the sense that it offers a view into something). IMO, DList should be changed to reference semantic, in that each DList will point to the same shared payload (a pointer pair [_first, _last]), and that all those DLists have the exact same view of that payload. If we do this, not only will DList work exactly the way people expect it to, we'll also gain in terms of implementation complexity. I wouldn't mind implementing it, but given I'd change the fundamental nature of the object, I'd want confirmation. If we do do this, then all the doc I just added would be wrong though (and some of the fixes here unneeded) :/ Should I go this direction? |
Perhaps we could have two doubly-linked lists; one being the current implementation and the other being what you just described. Thoughts? (Ideas for names?) |
@monarchdodra, please, separate e.g. docs changes and refactoring changes from logical. And, for such large diffs, also segregating addition of unittests may be useful. To do this, you may want to use SmartGit as it allows easy editing index before commit and very good diff view (but it have almost no rebasing support so I use SmartGit for this 2 things only). |
If you are still reading, I have a preliminary proposal here: http://forum.dlang.org/thread/zjjcupycjnqzoqwxrhyz@forum.dlang.org |
Addresses all issues in:
http://forum.dlang.org/thread/gjhclwsuqyhrimdeoaec@forum.dlang.org
and
http://d.puremagic.com/issues/show_bug.cgi?id=8905
opOpassign
intoopOpAssign
remove
andinsertBeforeNode
, which were more or less responsible for all the bugs in DList.Also, tons of unittests.
Finally: And this is kind of major, I scheduled for deprecation "stableRemove(R)" and "stableLinearRemove(R)", since neither could actually guarantee stability. For example: