-
Notifications
You must be signed in to change notification settings - Fork 142
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
An assortment of minor changes #692
Conversation
Really nice |
@@ -283,7 +283,7 @@ end | |||
convert(::Type{hid_t}, attr::Attribute) = attr.id | |||
show(io::IO, attr::Attribute) = isvalid(attr) ? print(io, "HDF5 attribute: ", name(attr)) : print(io, "HDF5 attribute (invalid)") | |||
|
|||
mutable struct Attributes |
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.
Is this the only mutable struct
-> struct
audited?
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.
I didn't check thoroughly — I noticed it while browsing through your rename PR and this one was the only one that stood out to me as not needing to be mutable since it doesn't add a finalizer.
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.
It looks like the only candidate, though:
$ git grep 'mutable struct'
src/HDF5.jl:mutable struct File <: DataFile
src/HDF5.jl:mutable struct Group <: DataFile
src/HDF5.jl:mutable struct Properties
src/HDF5.jl:mutable struct Dataset
src/HDF5.jl:mutable struct Datatype
src/HDF5.jl:mutable struct Dataspace
src/HDF5.jl:mutable struct Attribute
Just a collection of small changes I've been collecting. Notable things include:
show
method itself. I've also added a "fast path" that avoids the hack if the datatype is recognized as valid. (Unfortunately it's not likely to be taken often since most results probably give the built-in types, but it's something.)Float16
#341 just sitting there without resolution — here I've added the low-level methods that it was adding to be used.reinterpret
within_dataspace
actually creates aReinterpretArray
on modern Julia versions rather than anArray
(but apparently that's not an issue when passed down to C). The broadcast expression is also just easier to read.