-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Base.Ordering: do not ever discard order parameter
#34719
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
Base.Ordering: do not ever discard order parameter
#34719
Conversation
Prior to this commit, the `order` parameter was discarded if either `by` or `order` was passed. However, there is a sane interpretation for most of these combinations, and we should use that interpretation for least surprise. The one case that doesn't have an obvious interpretation is when a non-trivial `order` is passed together with an `lt` function; in that case it is better to error out rather than let it pass silently.
38e3919 to
805d22b
Compare
timholy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. You've got a bootstrap issue that needs solving (Revise hides such issues, sadly you'll have to build from scratch), but otherwise this looks good to me.
You might be able to solve it by switching from == to ===.
Fix bootstrapping issue
|
@timholy thanks for noticing the issue and for pointing out how to solve it :) Let's see what buildbot says now. |
Forgot to add the new test file to the list of tests.
|
Since this is technically breaking, let's see what PkgEval says: @nanosoldier |
|
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt |
|
The nanosoldier build reveals issues with ~20-30 packages, broadly in two classes:
The second case is easy to solve: I'll add a backward-compatible constructor As for the first case, bringin back Having said that, the prudent thing to do is to just leave it in... backwards compatibility is pretty important for a language. |
Add a backwards-compatible constructor for Base.Order.By.
Bring back the Base.Order.ordtype function.
|
@nanosoldier If this comes out clean, before merging it might be worth adding |
I could even add an |
|
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt |
|
Just checked the logs from nanosoldier's failures. It's only 8 now and no smoking guns pointing at this change. I think this is safe to merge. What's you opinion on an |
Agreed. Thanks for your care here.
That seems like a good idea to me. Once you add let's merge this. |
|
Bootstrapping... I'm checking if I can get VERSION and v"...." to work at bootstrap time and will update here. |
Pre-deprecate the ordtype function as we don't want to carry this in v2.0.
0d25f9a to
67d81cc
Compare
|
Found a way but it involves |
| # this functionality to those packages in the future; let's remind/force | ||
| # ourselves to deprecate this in v2.0. | ||
| # The following clause means `if VERSION < v"2.0-"` but it also works during | ||
| # bootstrap. For the same reason, we need to write `Int32` instead of `Cint`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly because Cint isn't defined yet? Using Int32 probably works because of little-endianness: if the return value is actually Int64 but the caller thinks its Int32 on a little-endian system, the value is right. Would fail on a big-endian system, although, of course, we don't support any of those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly because
Cintisn't defined yet?
Yes, that's probably it. I didn't attempt to re-shuffle the bootstrap order although it would be nice to have VERSION comparisons and safe ccall.
Would fail on a big-endian system, although, of course, we don't support any of those.
Do we support any platforms where Cint is different from Int32 at all? I can only find
const Cint = Int32in the source. If we do, your analysis about endian-ness is sound.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, I was thinking of long which is 32/64-bit. I guess I haven't been doing much C programming for a while now 😄
|
This is probably good to merge; the buildbot/tester_win32 failure happens during setup stage and seems completely unrelated. |
|
Very impressive work, @tkluck, thanks! |
Prior to this commit, the `order` parameter was discarded if either `by` or `order` was passed. However, there is a sane interpretation for most of these combinations, and we should use that interpretation for least surprise. The one case that doesn't have an obvious interpretation is when a non-trivial `order` is passed together with an `lt` function; in that case it is better to error out rather than let it pass silently.
Prior to this commit, the `order` parameter was discarded if either `by` or `order` was passed. However, there is a sane interpretation for most of these combinations, and we should use that interpretation for least surprise. The one case that doesn't have an obvious interpretation is when a non-trivial `order` is passed together with an `lt` function; in that case it is better to error out rather than let it pass silently.
Prior to this commit, the
orderparameter was discarded if eitherbyororderwas passed. However, there is a sane interpretation for most of these combinations, and we should use that interpretation for least surprise.The one case that doesn't have an obvious interpretation is when a non-trivial
orderis passed together with anltfunction; in that case it is better to error out rather than let it pass silently.For context, the reason why I'm interested in this is that I'm using custom subtypes of
Base.Order.Orderingto represent monomial orders in PolynomialRings.jl. It can be very useful to pass e.g.by=firsttogether withorder=@degrevlex(x > y).This also cleans up a seemingly unused function
ordtype.