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

extensible @views? #37412

Open
stevengj opened this issue Sep 5, 2020 · 0 comments
Open

extensible @views? #37412

stevengj opened this issue Sep 5, 2020 · 0 comments
Labels
arrays [a, r, r, a, y, s] speculative Whether the change will be implemented is speculative

Comments

@stevengj
Copy link
Member

stevengj commented Sep 5, 2020

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.

@stevengj stevengj added speculative Whether the change will be implemented is speculative arrays [a, r, r, a, y, s] labels Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] speculative Whether the change will be implemented is speculative
Projects
None yet
Development

No branches or pull requests

1 participant