Open
Description
Today I realized that option<my-resource>
or option<borrow<my-resource>>
could have the same size and representation as the resource itself, because (at least in the current bindings) -1 is used as an invalid value for the resource index.
As I didn't find the invalid value nor the optimization documented in the canonical ABI, I wonder whether this would be a reasonable addition to the spec. Similarly string and vector could have defined invalid representations which could optimize the representation of an option.
See https://doc.rust-lang.org/std/option/index.html#representation for the documentation of the Null Pointer Optimization on Rust.
Metadata
Metadata
Assignees
Labels
No labels