Skip to content

Conversation

quickfur
Copy link
Member

@quickfur quickfur commented Dec 2, 2012

This change makes joiner not assume anything about the persistence of .front. I know there has been no consensus on the transience issue yet, but this change is harmless and makes the code more robust, so I'm submitting it. Plus, it lets us close issue 8085 sooner, regardless of how the transience issue will be decided on.

@andralex
Copy link
Member

andralex commented Dec 9, 2012

Looks good. Is the ODX/64 failure caused by this?

@andralex
Copy link
Member

andralex commented Dec 9, 2012

I mean OSX

@braddr
Copy link
Member

braddr commented Dec 9, 2012

Given that it osx/64 passes the master branch builds and has never passed this pull request (across many attempts), it's pretty much a given that this pull request either causes or exposes the problem.

@quickfur
Copy link
Member Author

Based on the message produced by the assert statement, it seems that osx/64 is somehow doing something funny when returning dchar from string (as a range). Since that's unrelated to this pull request, I've decided to change the unittest so that it operates on dstring from the get-go. (Hopefully this will fix the failing autotest... somebody should look into why dchar conversion from string is acting funny, though.)

@quickfur
Copy link
Member Author

Rebased & tidied up commits.

@braddr
Copy link
Member

braddr commented Dec 10, 2012

While there's a repro, would you make sure to file a bug report to capture the problem?

@quickfur
Copy link
Member Author

Hrmph. Changing it to dstring didn't fix the problem. It's got to be a bug with string/dstring ranges on osx/64. However, I don't have any way of reproducing this 'cos I don't have access to osx/64, so the best I can do is just copy-n-paste the entire code into the bug report.

@quickfur
Copy link
Member Author

@quickfur
Copy link
Member Author

Alright, I'm sick of this buggy behaviour of strings/dchar on OSX/64 that I have no way to track down. Version out the failing unittest for until issue 9131 is fixed, and replace with another unittest that doesn't depend on strings of any sort.

@quickfur
Copy link
Member Author

OK now the autotester passes. Ready to merge! @andralex
(The previous autotester failures appear to be caused by utf8/dchar issues on OSX/64, which are unrelated to the actual joiner code.)

andralex added a commit that referenced this pull request Dec 17, 2012
@andralex andralex merged commit baf5737 into dlang:master Dec 17, 2012
@andralex
Copy link
Member

merged, thanks

if (_items.empty) return;
if (!_items.front.empty) break;
}
_current = _items.front;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd need to make this (provided we have forward iteration):

_current = _items.front.save;

To be able to make joiner a true forward range.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that's not enough. If the subranges are themselves ranges of ranges, then their respective subranges may be consumed if the user iterates over the .save'd range.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... But now we're back to the square one argument: That is just the element type of the "RoR" that we are iterating over. They are just elements, but not part of our range interface. This "third level" range is just as irrelevant to us as the "second level" range is irrelevant to array.save.

We were tasked with transforming the RoR into a R. The fact that those elements are also themselves ranges is not our problem, and shouldn't be our problem. Maybe the user wanted to have a RoR whose elements are mutable char[], which are not meant to be duplicated. What do we know?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, the .save exposed by joiner only guarantees saving the state of the joined ranged itself, it says nothing about the state of the elements themselves. My bad.

@monarchdodra monarchdodra mentioned this pull request Dec 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants