JuliaIO / HDF5.jl

Save and load data in the HDF5 file format from Julia
https://juliaio.github.io/HDF5.jl
MIT License
386 stars 140 forks source link

Tuple support #1060

Closed lxvm closed 1 year ago

lxvm commented 1 year ago

Since there is already support for reading/writing compound types, I wanted to try adding support for Tuples as well, since sometimes saving tuple data is convenient, or compound types have tuple data (e.g. SArray). This pr writes tuples to compound types with member names corresponding to the indices of each element, i.e. var"1", var"2", var"3",.... I understand that there is no native HDF5 type corresponding to a tuple, however this pr is non-breaking and since tuples will be read back as named tuples, which inherit the majority of behavior from tuples, this only provides additional features. Please advise.

I also made the following changes:

I also prepared a follow-up pr showing that we can save StaticArrays as compound types (https://github.com/lxvm/HDF5.jl/tree/pr_sarray), although one method would change in a breaking way.

mkitti commented 1 year ago

I'm going to try to get this formatted and merged soon to do a release.