-
Notifications
You must be signed in to change notification settings - Fork 18
Immutable Views #36
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
Comments
@Rory-Finnegan, now that julia 0.4 is out, is there any reason not to use One advantage of starting with SubArray is that it can form a view of an arbitrary |
@timholy, thanks, I didn't realize |
Oh, the other issue is that I don't want the parent array to be immutable, just the view. Making a |
A read-only mode could also be useful to ease the transition to returning array views by default from |
Are you worried about usage verbosity or something different? In your own code you could define a one-liner helper function
if you wanted. Since the two concepts are orthogonal, to me it seems to be an advantage to keep them well-separated---you could make a ReadOnly full sized-view, if you needed to. If you're worried about the implications for performance, my bet is that all of this will get elided by the compiler, except the splatting penalty. If that's problematic, you can use a |
I think there are a lot of situations where it would be nice to have an immutable view. I find it very useful to return ArrayViews when "querying" a larger Array, however, I'd like to make those views read-only. This is mostly for my own sanity for now, but I could see this being more important once threading gets worked into base julia.
I've started an initial attempt at this here using a simple
mutable
keyword.Example:
or
I'm not sure if this is the best way to do this in the long run, but for now it avoids manipulating the type hierarchy or breaking any existing functionality.
The text was updated successfully, but these errors were encountered: