A,
There are a number of ways to do this, and the examples are just based on what you suggested as an array of structs.
The array of uninitialized structs would be roughly equivalent to the C version of allocating an array of pointers to structs of ExampleEvent (without allocating the struct itself). The struct is uninitialized -- so you can't set a value of a named field until it's allocated.
As far as I see it, this is just a syntax issue, as the concept is the same in Julia and C.
One simple solution to continue on this example would be to define a function to give you the event you care about (by index) that includes initialization. You can then process events for fields as you see fit and out of order.
julia> function get_event(v::Vector{ExampleEvent}, i)
n = length(v)
if i > n
for j in n:i
push!(v, ExampleEvent("",0,0,0,0,0,0)) # default values
end
end
v[i]
end
Then you can initialize a zero length vector and use it as such:
julia> events = Vector{ExampleEvent}()
0-element Array{ExampleEvent,1}
julia> e = get_event(events, 3); e.fld1 = "asdf"; e.fld3 = 3; e.fld7 = 7; events
4-element Array{ExampleEvent,1}:
ExampleEvent("",0,0,0,0,0,0)
ExampleEvent("",0,0,0,0,0,0)
ExampleEvent("asdf",0,3,0,0,0,7)
ExampleEvent("",0,0,0,0,0,0)
Perhaps that helps.
Cameron