-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add StructArrays.append!! #97
Conversation
Codecov Report
@@ Coverage Diff @@
## master #97 +/- ##
==========================================
+ Coverage 91.03% 91.36% +0.32%
==========================================
Files 9 9
Lines 368 382 +14
==========================================
+ Hits 335 349 +14
Misses 33 33
Continue to review full report at Codecov.
|
Thanks for the PR! In principle I see nothing wrong in making this specific function public, it has been unchanged for a while. I wonder whether you also need Somehow I wonder whether it's possible to flip the dependency story and let StructArrays use the BangBang machinery to implement the constructor from an iterable (Tables.jl could probably also use that, see https://github.com/JuliaData/Tables.jl/blob/master/src/fallbacks.jl#L146). At the moment I suspect it's not feasible as BangBang is a bit too heavy to be a dependency of StructArrays, but maybe there is a refactor that makes this possible. |
Thanks for pointing this out. If you are OK with adding
This is a best case scenario for me :) I think it'd be nice since you can have a uniform API that can also be used with immutable types like
Yes, BangBang tries to replicate some non-trivial portion of Base API so it's a bit hard to turn it into a small package. I don't think it's impossible, but, since it's still a young package, I want to consolidate its API and implementation first before splitting it up. |
I was a bit sloppy, what I meant is that there is a collection mechanism for the two cases, known and unknown size. The problem is that the two do something different, one uses Maybe the easier would be to expose to BangBang the equivalent of |
I guess I confused you or I'm still confused (or both). To clarify what I meant by StructArrays.jl/src/collect.jl Lines 132 to 168 in 2c260ad
Are you OK with adding this as a public API so that I can wrap it as
Thanks a lot for pointing this out! I was focusing providing
I haven't implemented index-based |
Ah, now I get it! I used that iterators have length to preallocate the whole thing at once (and skip I only have some minor nitpicking in terms of names (I may have induced the confusion, being unclear in a previous post). Could Happy to merge after the renaming. |
Thanks for the review. Yes, |
FYI, I just added |
I'm trying to create a uniform interface (e.g.,
BangBang.append!!
) for mutate-or-widen style manipulations of various container types. This is very useful for implementing push-oriented data manipulation API likeTransducers.copy
.As
StructArrays
already hasgrow_to_structarray!
, it would be nice if I can use it as-is. Are you OK with providing it as a public API? This PR adds documentation in README to explicitly document it as a public API.