view, sub, slice, ArrayViews

371 views
Skip to first unread message

David van Leeuwen

unread,
Jun 28, 2016, 3:57:43 PM6/28/16
to julia-dev
Hello, 

I am trying to bring GaussianMixtures.jl up to scratch with Julia v0.5.  This package depends on StatsBase, Distributions, Distances, Clustering a.o.  These in turn use ArrayViews and view and slice, which give me many deprecation warnings and ambiguity errors, because Julia v0.5 Base defines `view()` and deprecates `sub()` and `slice()`.  I think. 

Is there somewhere information on what julia-v0.5 will support from Base in terms of `view()`, and how ArrayViews and other packages are supposed to deal with that?  Is there (going to be) support in Compat?

I can work on making PRs for StatsBase, Distributions, Distances, Clustering (should I do that?)---but I find myself digging deeper and deeper, only optimizing for deprecation warnings and errors, without too much understanding of the current status of v0.5 arraymageddon---also in relation to changes in `Symmetric` and `cholfact()`. 

Thanks, 

---david

Tony Kelman

unread,
Jun 28, 2016, 6:26:43 PM6/28/16
to julia-dev
Base now uses "view" for the behavior that used to be "slice." Importing Compat.view will soon use the formerly called "splice" behavior even on old Julia versions. Last I heard, ArrayViews is a bit faster than the Base SubArray type on small arrays, so you may still want to use it - benchmark first. That package should probably be changed to no longer export view though. Maybe only on 0.5?

David van Leeuwen

unread,
Jun 29, 2016, 2:53:32 AM6/29/16
to julia-dev
Hello Tony, 


On Wednesday, June 29, 2016 at 12:26:43 AM UTC+2, Tony Kelman wrote:
Base now uses "view" for the behavior that used to be "slice." Importing Compat.view will soon use the formerly called "splice" behavior even on old Julia versions. Last I heard, ArrayViews is a bit faster than the Base SubArray type on small arrays, so you may still want to use it - benchmark first. That package should probably be changed to no longer export view though. Maybe only on 0.5?

On yesterday's 0.5.0-dev+4968:

julia> sub(rand(10,10), 1, :)

WARNING: sub is deprecated, use view instead.


So `view` is apparently more than just a replacement of `slice`. 


So I started to change the use of `slice` by `view` in packages like Distributions, but then `view` clashes with ArrayView.view.  So I guess it should be replaced by `Base.view` instead.  In packages like Clustering, `ArrayViews.view` is re-exported, which is troublesome for 0.5 (at least, I can't get it to work).  


---david

Stefan Karpinski

unread,
Jun 29, 2016, 11:13:49 AM6/29/16
to juli...@googlegroups.com
This bug might have been part of the problem: https://github.com/JuliaLang/julia/issues/15760.
Reply all
Reply to author
Forward
0 new messages