-
Couldn't load subscription status.
- Fork 8k
Minor cleanup of some unused code in SPL #5430
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
|
These flaky tests are a real pain. I must do something about them. Travis failure is only on S390X:
AppVeyor failure is something to do with MySQL:
...Both utterly unrelated to this removal of unused code from SPL. |
|
I've merged a part of these, not sure about the rest wrt a possible migration from Iterator -> IteratorAggregate. I guess for SplHeap that just isn't possible, because the iterator is actually destructive, so two iteration streams wouldn't ever make sense? |
That's a very good point about SplHeap. The API for that one really has me scratching my head. Not sure what the original implementer was thinking. |
|
Is there any reason for keeping the Please note that removing those fields is not something specifically related to the change to IteratorAggregate -- the fields are just literally unused. There is nothing anywhere in the codebase which reads them. They are just set and then ignored. |
|
@nikic I am wondering if what you said above might apply to SplPriorityQueue as well... SplPriorityQueue uses flags to determine whether it should return an item, a priority value, or an array of the two from Since it currently ignores the flags on the iterator and just uses the flags on the pqueue object, it means that if But then again, I wonder if that's a bad thing. It's a bit hard to say which is better. The direction of DLL iteration changing in the middle of a |
2e1a172 to
de01aa1
Compare
|
OK, fixed this up and force-pushed... Please note that the constant I personally feel that SplMinHeap et al do not need to use the (currently unused) However, if you feel that this behavior of SplMinHeap should be changed, that is fine. I can do that. |
de01aa1 to
201ef99
Compare
|
Ping... I'd like to suggest that the changes to |
|
I feel that Maybe I should try to implement deprecation of class constants? |
|
I cherry-picked the changes related to the SplDoublyLinked list fix.
The same goes for IT_MODE_FIFO though. Both of those are simply the default. I assume IT_MODE_KEEP exists as the counter to IT_MODE_DELETE, to explicitly specify the behavior. As such, I'm not completely convinced that it should be removed.
Not sure on this part... But probably you're right.
Wouldn't hurt for sure ^^ Even if it's not immediately necessary, we can add a deprecated class constant to zend_test, because this will definitely come up in the future. |
The body of spl_heap_get_iterator is almost identical, and we can easily reuse it.
201ef99 to
4285026
Compare
|
OK, force-pushing very different changes to |
Previously, the `flags` field in the iterator for SplMinHeap, SplMaxHeap, and SplPriorityQueue was unused. This does not affect SplMinHeap and SplMaxHeap in any way, since there are no iteration flags which apply to them. But for SplPriorityQueue, it meant that if one began a `foreach` loop and then set the 'extract flags' partway, the type of data being yielded to the loop would change. (The extract flags cause SplPriorityQueue to yield either the items stored in it, their priority values, or both together in an array.) By using the iteration flags in the iterator struct, it means that once a `foreach` loop begins, the value of the 'extract flags' at the beginning of the loop will apply to that loop until it terminates.
4285026 to
aa20b7d
Compare
|
Also added a new unit test. |
Thanks for the good point. I actually came to a similar conclusion after thinking about it more. |
|
What's the state of this PR? |
|
There has not been any recent activity in this PR. It will automatically be closed in 7 days if no further action is taken. |
|
@alexdowad are you planning on having another look at this or should this be closed? |
|
There has not been any recent activity in this PR. It will automatically be closed in 7 days if no further action is taken. |
No description provided.