[Vm-dev] Custom module primitive error codes
monty2 at programmer.net
Wed Sep 6 11:12:02 UTC 2017
#primitiveFailFor: can be used to signal a primitive failure with an integer error code. The VM can map a small set of these codes to symbols like #'bad argument' that can be checked for in <primitive:...error:> methods.
How should a module primitive use #primitiveFailFor: with its own custom error codes, so that they don't collide with the VM's current and future set of PrimErr* codes? This RSqueak issue says to use negative integers for application-specific errors: https://github.com/HPI-SWA-Lab/RSqueak/issues/130
Is that preferred for modules?
More information about the Vm-dev