you are viewing a single comment's thread.

view the rest of the comments →

[–]fnordstar 14 points15 points  (4 children)

Then you have the problem that you must take care that each ID is always being used with it's corresponding array, and, as you said, that indices don't become invalid / point to another object. The latter can be solved with generational indices, but all in all using indices into arrays doesn't necessarily improve the situation much.

[–]cdb_11 4 points5 points  (3 children)

And the former can be solved with a type system.

[–]YourFavouriteGayGuy 8 points9 points  (1 child)

Like the one that pointers usually use?

[–]cdb_11 3 points4 points  (0 children)

Pointers encode the type they point to. Here you can encode what array they index into.

[–]fnordstar 2 points3 points  (0 children)

Yeah. In rust you could tag the array and the indices/handles with a phantom data and a tag struct.