Help implementing new iterate interface?

I’m trying to implement the new iterate interface in JLD.jl, but I can’t get it to work, mostly because I don’t quite understand the original implementation.

I tried

Base.iterate(parent::Union{JldFile, JldGroup}, state) = state[2] < length(state[1]) ? nothing : 
        (parent[state[1][state[2]]], (state[1], state[2]+1))

but that did not work.

did you try giving state the default value that start used to return? i.e.

Base.iterate(parent::Union{JldFile, JldGroup}, state = (names(parent), 1)) = ...

Perfect, that seems to have worked. Thanks!