Skip to content
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

Merged
merged 8 commits into from
Oct 7, 2020
Merged

An assortment of minor changes #692

merged 8 commits into from
Oct 7, 2020

Conversation

jmert
Copy link
Contributor

@jmert jmert commented Oct 7, 2020

Just a collection of small changes I've been collecting. Notable things include:

  • Moving the datatype printing workaround from the low-level function to the 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.)
  • I bound a few more low-level wrappers. This was motivated in part by seeing Added support for Float16 #341 just sitting there without resolution — here I've added the low-level methods that it was adding to be used.
  • Using reinterpret within _dataspace actually creates a ReinterpretArray on modern Julia versions rather than an Array (but apparently that's not an issue when passed down to C). The broadcast expression is also just easier to read.

@musm
Copy link
Member

musm commented Oct 7, 2020

Really nice

@musm musm merged commit 6425081 into JuliaIO:master Oct 7, 2020
@jmert jmert deleted the grab_bag branch October 7, 2020 03:47
@@ -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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants