Skip to content
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

Declare StaticArrays functions in StaticArraysCore #11

Open
cscherrer opened this issue Sep 12, 2022 · 3 comments
Open

Declare StaticArrays functions in StaticArraysCore #11

cscherrer opened this issue Sep 12, 2022 · 3 comments

Comments

@cscherrer
Copy link

Avoiding a dependency on all of StaticArrays requires being able to define all needed methods using only StaticArraysCore. For example, in this Accessors PR we need to be able to this code to work:

@inline delete(obj::StaticArraysCore.SVector, l::IndexLens) = deleteat(obj, only(l.indices))
@inline insert(obj::StaticArraysCore.SVector, l::IndexLens, val) = insert(obj, only(l.indices), val)

But deleteat and insert are declared (and defined) in StaticArrays itself, so these two lines of code currently require all of StaticArrays before the compiler will even accept them.

This seems to defeat the purpose of having a separation like this in the first place. This makes me wonder, could there be a minimal set of functions in StaticArrays that you'd consider useful for interfacing from "StaticArrays-optional" libraries like Accessors?

Could deleteat and insert, and whatever other functions you think might play a similar role, be declared in StaticArraysCore, and then implemented in StaticArray?

@mateuszbaran
Copy link
Collaborator

Sure, we can declare functions in StaticArraysCore.jl. We already have similar_type here, feel free to make a PR for other functions you need.

@cscherrer
Copy link
Author

Great! Looks like we need deleteat and insert. I guess we'll need to PR both StaticArraysCore and StaticArrays, to reflect that StaticArraysCore will now "own" both of these functions.

@mateuszbaran
Copy link
Collaborator

Yes, exactly, one PR like this one: #5 and one like this: JuliaArrays/StaticArrays.jl#1084

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants