Hello, maybe someone else has had this problem with maps halting the entire program, when are printed?
I have a map of unions, that have ptrs to more maps of the same type, however, this isn't a self-referential problem, I tested it & Odin simply stops printing after the first depth (I also have no way for maps to become self-referential)
The program only freezes when the top map has more maps. If it only has ints, strings or dynamic arrays, it used to print perfectly, now it gives a memory access violation, but the values inside are still perfectly accessible.
Also, when I try to deference the inner maps, I get a memory access violation, but the pointer (transmuted to ^int) is fine: 0x1358E799878
And also also accessing values inside of inner maps and printing them (unless they are a map) works perfectly.
I only create different kinds of maps in the same* function in different ways, which leads me to believe it's something with the initialization/types..?
I haven't been able to replicate it & make it into a manageable snippet and I'd rather not paste the whole file, so here are some, maybe related, snippets:
Table :: map[string]Type
Type :: union {
^Table,
^[dynamic]Type,
... // other types aren't pointers
}
... // \/ initing top-most map // This all happens in the same function:
tokens := make_map(Table)
top: ^Table = &tokens
section: ^Table = &tokens
... // \/ adding inner maps
top[nextnext] = new(Table)
section = top[nextnext].(^Table)
...
fmt.println(tokens["table"])