Delete unnecessary convert() method for OrderedDict#159
Delete unnecessary convert() method for OrderedDict#159JamesWrigley wants to merge 1 commit intoJuliaCollections:masterfrom
convert() method for OrderedDict#159Conversation
This causes invalidations and already has a decent definition in Base.
|
(bump) |
1 similar comment
|
(bump) |
|
@fingolfin, @Tokazama, apologies for the direct ping, but would it be possible to review this? 🙏 |
|
Are we worried about that depwarn disappearing? If it doesn't break code I think this is great |
|
Good point, I'm not sure about the depwarn 🤔 One could argue that since the conversion is defined in Base we should support it too, as long as there's no technical reason not to. |
|
I guess the question is if we still care about associative containers being sorted before conversion. Our direct constructors consume unordered associated containers, so I'm not sure why people decided We don't have this warning/error tested, good documentation for why it's there, or any reason to believe its absence will cause errors downstream. On top of that it looks like it resolves a good chunk of invalidations. I'd say add a minor version bump and we release it. Unfortunately, I'm back on the hospital floors full time in a couple days, so I'd like someone else to be following this repo for issues over the next couple months in case some problems arise. |
|
I just enabled notifications for the repo, I can commit to fixing any issues from this in the near future 👍 |
|
Thank you for the ping. The original discussion is here. I stand by the general point that non-deterministic behaviour (like conversion from Dict to OrderedDict) is a footgun in Julia, and that to the extent possible it's good to avoid it. I won't mind too much if this definition is taken out, but personally I would vote against. I'm curious how this causes invalidation. This package owns |
|
I see 🤔 The reason it causes invalidations is because the package defines a more specific method of |
|
That's too bad. Thank you for looking around for invalidations, it's important work. I don't know how else that could be tackled. Should some of that logic be moved to Base? If it's easy, can you give an example of code that gets invalidated? If the code is type stable, then it shouldn't get invalidated no? An OrderedDict has an ordering. AFAIC converting an unordered dict into an ordered one should be a MethodError, just like you can't meaningfully convert a Date into a DateTime object.
That's a bug to me. |
|
A pragmatic solution to this issue might be to change BTW I saw JuliaLang/julia#61329, and I think it's great (though I'm not quite sure how it would help here) |
Sadly that did not fix it 🥲 I think because it's still inserting a new method that 'overlaps' with AbstractDict. I don't think there's a good way to fix it without modifying Base unfortunately, so I'll close this.
Yeah it's not related, just wanted to give you a heads-up since it would allow changing OrderedCollections. |
This causes invalidations and already has a definition in Base: https://github.com/JuliaLang/julia/blob/8c145c1e0e4676ce57a32d7125cae05a2ece3ac6/base/abstractdict.jl#L577
Fixes these invalidations:
The original loop seems to be quite old so I don't think we'll miss anything by removing it. Would it be possible to make a release with this?