rust-hosted-langs / book

Writing Interpreters in Rust: a Guide
https://rust-hosted-langs.github.io/book/
Creative Commons Attribution 4.0 International
479 stars 27 forks source link

Runtime type identification and tagged ptr types #31

Open pliniker opened 4 years ago

pliniker commented 4 years ago

Instead of the enum TypeList in interpreter/src/headers.rs, we should explore better type identifier means.

For example, can we generate a compile-time const for each object type that can be used to map to a trait object, where the trait object provides core runtime functions for each object type? This would be less verbose than the enums and mapping between tagged pointer types, possibly at some cost. Perhaps some combination of the two approaches would make sense?