Random trick: if you allocate different types (of a set of contextually possible...

@pervognsen@mastodon.social

Random trick: if you allocate different types (of a set of contextually possible variant types) in appropriately aligned parts of the virtual address space, a type-tagged pointer can be (unsafely) dereferenced directly as if it were an untagged pointer. And with this scheme you can replace unsafe type/variant confusion with safe slot confusion by unconditionally setting the tag bitfield to the expected type tag.