-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Standard API for push_widen! pattern #34478
Comments
The other place this pattern is implemented is BangBang.jl just so that people who come across this issue know what options are currently available. There's also been many discussions on discourse wanting a standardized interface for this functionality, e.g.:
(I know there's more not just involving tpapp, but those are what I found with a quick search) If there was a generic way to expose this as an interface, I think that would be lovely. |
Let me also link some interesting discussions that came up when implementing BangBang interop with other packages (just the ones I remember): JuliaData/TypedTables.jl#55 Also other related issues:
I think it'd be nice to add an interface |
Actually, I think it just has to be an appropriate "bottom" type for the container. It's |
Also ref #30076 |
There is a common pattern for handling not knowing the type of something produced in an iterative fashion, and gathering it up into the smallest container.
Basically you start with the container able something (This bit I think sometimes varies, it could be the first elements eltype, could be result of
@default_eltype
),then you get the next thing you want to put in, if it fits then you push it in and continue,
if not then you make a new collection that can hold the union, copy everything over and then repeat.
The core of it is in
push_widen!
but bits of the setup are in theSet
construct, inunique!
and in other placesjulia/base/array.jl
Lines 681 to 716 in 2d57411
We should look into a standard and public way to do this.
Its wanted in JuliaCollections/DataStructures.jl#568 (comment)
The text was updated successfully, but these errors were encountered: