Generic operator instructions would be mul, add, eq etc.
They would be just "funny looking function calls", i.e. they would silently create a frame and call the function associated by given operation for the recipient of the message.
Example:
new 2 Foo
new 3 Bar
mul 1 2 3
could be translated to:
frame ^[(param 0 (ptr 4 (new 2 Foo))) (param 1 (ptr 5 (new 3 Bar)))]
msg 1 __multiply
Clearly, the first form is much shorter.
This would be most useful for custom types, as built-ins have their dedicated operator instructions.
This is too high-level to be implemented in machine's core. Operator overloading should be resolved by compilers, on the assembly level they should look like ordinary function calls.
Generic operator instructions would be
mul
,add
,eq
etc. They would be just "funny looking function calls", i.e. they would silently create a frame and call the function associated by given operation for the recipient of the message.Example:
could be translated to:
Clearly, the first form is much shorter.
This would be most useful for custom types, as built-ins have their dedicated operator instructions.