Hey,
I read that you can’t use dynamic dispatch with the programming language Move.
Does the static bytecode verifier also check if there is dynamic dispatch used or would it be possible that somebody could create a language that compiles to Diem Bytecode which could allow dynamic dispatch?
Thanks
Does the static bytecode verifier also check if there is dynamic dispatch used
This is not checked by the bytecode verifier. The Call
instruction accepts a static identifier for a function, and at runtime that function is invoked. However, the bytecode verifier does check that the static identifier refers to a valid function (e.g., for 0x2::M::f
, that a public function named f
exists in the module M
and has the expected type).
would it be possible that somebody could create a language that compiles to Diem Bytecode which could allow dynamic dispatch
This would not be possible because the VM’s call instruction requires a static function identifier, as explained above.