-
Notifications
You must be signed in to change notification settings - Fork 37
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 an is_resizable
trait?
#22
Comments
Agreed. |
Is it worth distighishing this into: Or maybe it is a trait with multiple values:
|
Really i feel like we want to answer questions about:
|
If |
Yes, to group them. And to name them. But anyway Jameson says my plan is impossible. |
I created something similar for this here https://github.com/Tokazama/StaticRanges.jl/blob/f8dac65496c10ea0ec0fbf748006af105f77f62e/src/staticness.jl#L1. |
an |
FYI, BangBang internally now has julia> possible(push!, Int[], 1)
true
julia> possible(push!, Int[], 0.5)
false At some point, I'd like to pull this out of BangBang.jl as a separate library but I also need to deal with non-array containers and objects. So, I don't see ArrayInterface.jl as a good target. It would be great if the part of ArrayInterface.jl that is not array-specific can be factored out. |
Is this compile time thing or is it all checked at run time? Sorry if you document it elsewhere but I only read what you linked. |
It's all type-level so everything should be done at compile time. |
If I understand your code correctly you're using a union internally to group mutable and immutable containers. Wouldn't we want to use traits to avoid having to redefine the union type for every new type that needs this behavior? |
The |
Okay, maybe I misunderstood the suggestion. Is your suggestion that instead of defining implements(::typeof(resize!), ::Type{<:Array}) = true |
I'm just mentioning that I explored the API @oxinabox mentioned above #22 (comment). (I'm also suggesting to create a new package (upstream to ArrayInterface.jl) that can handle arbitrary containers and objects, not just arrays. But that's not the main topic here.) |
New trait for collections that change sizes (issue #22)
Perhaps I should open a separate issue for this, but it would also be useful to have |
It'd be nice if there was an abstract array interface specifying whether an array is resizable in-place.
The text was updated successfully, but these errors were encountered: