Skip to content

Iteration and pairs not consistent with getindex or read #4

Closed
@yha

Description

@yha

The values returned from iteration over an AbfFile (or over the result of pairs) don't match what you get from indexing. Instead the values are of the undocumented type AbfKey. This violates the contract of pairs, and arguably also of the AbstractDict interface:

using AlignedBinaryFormat

tmp = tempname()
abfopen(tmp, "w") do abf
    abf["k"] = rand(10)
end

abf = abfopen(tmp, "r")
v = abf["k"]
k1, v1 = first(abf)  # or `first(pairs(abf))`
@assert v === v1     # fails
typeof(v1)           # == AlignedBinaryFormat.AbfKey
@show v[1]
@show v1[1] # ERROR: MethodError: no method matching getindex(::AlignedBinaryFormat.AbfKey, ::Int64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions