-
Notifications
You must be signed in to change notification settings - Fork 51
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
Deprecate field access of SparseMatrixCSC? #37
Comments
(ping @fredrikekre as you reacted in the previous discussion) |
Thinking about this a bit after the previous discussion JuliaLang/julia#32953 (comment), I'm now somewhat against deprecating or banning the field access. It is very trivial for new |
I would personally be in favour of deprecating and generally having everyone use accessor methods for all sparse data structures going forward. But, at the same time, we probably have many other things to do in sparse matrix land and this is perhaps not the most pressing issue. While the implementation of this is straightforward, it may cause quite a bit of follow-up work as it propagates through the packages. How about we leave this issue open to collect comments for now (while we focus our attention on other things)? |
+1 for leaving it open and focusing on other issues. We can come back to this anytime later. |
Actually, the fields of It explicitly says "internal representation" so I don't know if it is considered a public API though. |
I believe those are documented for the purpose of explanation. Internal representation certainly means "do not count on these". |
The only way to use and modify SparseMatrixCSC efficiently in many situations is to use these field so they are de facto public. Just removing/changing their name is likely to be very disruptive to the ecosystem (grepping through packages for |
There are like five issues/PRs discussing changing the sparse array APIs at this point. And the one that Simon opened with the clearest plan has been closed in favor of a PR with an unclear plan and breaking changes that we definitely cannot make. Can we reopen the original plan issue and actually come up with a coherent plan before making any more half-baked PRs changing things? |
The one that Simon had was not about API but rationalization of field names, which is something we are clearly not doing. I don't see the point about opening up that discussion again. |
What half-baked PRs are you talking about? It can be confusing to follow along since the work is spread out across several PRs, but I don't see how you can label these contributions as half-baked. |
That's why I closed JuliaLang/julia#33050 in favor of JuliaLang/julia#33054 (see JuliaLang/julia#33050 (comment)). I thought to keep opening this issue makes sense as JuliaLang/julia#33054 is about API addition, not deletion.
There is nothing breaking in JuliaLang/julia#33054 at all. Or at least that has been my intention. Please comment in JuliaLang/julia#33054 if you find anything breaking. |
I apologize about calling your PRs half-baked. It was uncalled for and shitty of me. I appreciate all your work on these things and don’t want to discourage it. I’m frustrated about a few things:
My proposal: either reopen Simon’s issue proposing better names or create a new issue (not a PR) to discuss what to do about the sparse APIs; come to some kind of agreement on that issue and only then set about executing the plan. I do not think that we can break existing code that accesses fields, but we can rename fields and provide getproperty methods that allow the old names to continue to work. So pick the names you want, change them to those, make the old ones work, update the docs. |
I have reopened https://github.com/JuliaLang/julia/issues/25118 that @simonbyrne opened about fieldnames for SparseMatrixCSC. |
@StefanKarpinski I think I understand your frustration about linear algebra / sparse arrays code base. I imagine many maintainers and contributors share similar feelings. (Off topic, but it would be nice if these stdlibs can go to Pkg-like development mode which may mitigate some of the issues.) I summarize the recent activities related to SparseMatrixCSC in the issue opened by @simonbyrne https://github.com/JuliaLang/julia/issues/25118#issuecomment-524654446. It would be nice if you can share thoughts about it there. |
In JuliaLang/julia#33054 I proposed to expose
AbstractSparseMatrixCSC
interface so that it is possible for package developers to easily writeSparseMatrixCSC
-like custom matrices (without worrying about implementing all the complex functions including the broadcasting machineries). @ViralBShah was asking in JuliaLang/julia#32953 (comment) if it makes sense to deprecate field access. The rationale is that it pushes package authors to useAbstractSparseMatrixCSC
interface so that subtypes of it other thanSparseArrays.SparseMatrixCSC
would work for their code.This is technically OK since those fields are not a part of the public API.(Edit: It may not be considered completely private. See: https://github.com/JuliaLang/julia/issues/33056#issuecomment-524583635)As the accessor like
nonzeros
have exited for more than 4 years since Julia 0.4 (#8720), I'd assume that all existing and maintained code base already have migrated to the accessor methods. If that's the case, this deprecation would not be very destructive (although the effect would be small at the same time).As a side note, I added
getproperty
definitions forSparseMatrixCSC
andSparseVector
in test suite in JuliaLang/julia#32953 so that we can enforce don't-use-fields rule in the future development of SparseArrays.jl itself. So, enforcing the rule inside SparseArrays.jl is not a strong enough argument to ban field access for users.The text was updated successfully, but these errors were encountered: