-
Notifications
You must be signed in to change notification settings - Fork 2
Remove generic AbstractArray
fallbacks for position
#26
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
+ Coverage 84.86% 86.38% +1.52%
==========================================
Files 10 9 -1
Lines 185 191 +6
==========================================
+ Hits 157 165 +8
+ Misses 28 26 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely agree to get rid of that definition, as this clearly might silently give you wrong results.
Also agreed to having the option of specifying defaults one at a time, in a future PR.
This makes sense to me, I had concerns with these definitions before. Thanks Matt! |
@lkdvos any more comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Closes #16. This removes generic fallback definitions for the positions of
eltype
andndims
for AbstractArrays, which is safer since not all of them haveeltype
in the first position andndims
in the second position.This was inspired by a bug I was hunting down while working on ITensor/QuantumOperatorDefinitions.jl#22, which was due to a
BitArray
using the generic position definition, which was incorrect because it doesn't have aneltype
parameter since it is alwaysBool
, andndims
is in the first position. In this PR, I added explicit correct definitions forBitArray
.@lkdvos @kmp5VT
I think this will be a good move. One issue this PR reminds me of is that right now default parameters are defined like:
i.e. they are defined in a list. This is ok, but I think it would be nicer if we could define them one at a time using the parameter names:
I remember we tried that earlier on and it was tough to make type stable, but I think it would be good to revisit that (but not in this PR). (EDIT: Raised an issue here: #27.)