Re:Flattening ASTs (and Other Compiler Data Structures)
by logicchains on Sunday July 02, 2023 @10:12AM
(#36561664)
You can use phantom-typed index types (a wrapper type per container) to recover type safety. Or at least you can when using an ECS in C++; I'm not sure how easy it is to write the wrapper types generically in Rust.
[ Parent
| on HN ]
Re:Flattening ASTs (and Other Compiler Data Structures)
by pornel on Sunday July 02, 2023 @04:58PM
(#36565666)
You can have typed indices (https://lib.rs/crates/typed-index-collections), but unless you force the collection to be a singleton, there's no way to prevent mixing of indices between different instances (clones) of the same collection type.