-
Notifications
You must be signed in to change notification settings - Fork 5
Replace truncate! with truncate
#60
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
truncate as a replacement for truncate!truncate! with truncate
|
@lkdvos I think all of our uses of When functions return multiple different things, I generally prefer to name them explicitly to indicate that, such as |
|
@mtfishman I understand what you mean, but given that this is an unexported function, mostly used for internal implementation purposes, I am not sure if this really matters? I think I prefer the shorter form, but obviously it doesn't actually make a difference so 🤷 |
I kind of see your point, but also having a longer and more explicit name would make it clearer for downstream packages like BlockSparseArrays.jl what the function outputs when it gets overloaded and used, even if it is just for the developer. I'm not going to die on this hill, just sharing how I would design it if it was up to me. I suppose I'm a little confused by your comment though, should we not being using it in BlockSpareArrays.jl? I find it to be a useful abstraction layer. |
This PR removes the use of
truncate!, as it can be convenient for the pullback rules to have access to the truncated indices without having to repeat the logic oftruncate.Additionally the non-bang-method makes sense since our implementations do not alter the input arrays (and shouldn't for the pullbacks to remain valid).
Depends on #61