We could support generic pointers that could point to memory, calldata, code and others. This could be done by using a single byte to store the pointer type, and load the value into memory differently depending on the type (inside the asBytes, and the other asX functions). The only problem would be storage pointers, as we would need the whole 32 bytes to represent it... maybe we could do it in some other hacky way.
We could support generic pointers that could point to memory, calldata, code and others. This could be done by using a single byte to store the pointer type, and load the value into memory differently depending on the type (inside the
asBytes
, and the otherasX
functions). The only problem would be storage pointers, as we would need the whole 32 bytes to represent it... maybe we could do it in some other hacky way.See @jtriley-eth 's https://github.com/jtriley-eth/smart-types/tree/main/src/ptr for how loading from different locations could work (our implementation would be different though, as we would have a single Pointer custom type).