Skip to content

Declare StaticArrays functions in StaticArraysCore #11

Open
@cscherrer

Description

@cscherrer

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions