Skip to content

extensible @views? #37412

Open
Open
@stevengj

Description

@stevengj

Should @view or @views be extensible to other things besides ref (getindex) expressions? For example, @views could change every function call f(...) into:

maybeview(f::F, args...; kws...) = f(args...; kws...)

which packages could overload to add view support for their functions on selected argument types.

For example, as I commented in another #37367, numpy.flip returns a view, which is much faster than explicitly computing reverse and is sufficient for many if not all usages of reverse; it might be natural for @views to change reverse calls on array arguments into view constructors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]speculativeWhether the change will be implemented is speculative

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions