You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once traits are implemented, it would make sense to make all the built-in operators dispatch to trait methods instead of magic bytecode. This does mean that for a few releases basic operations will take a performance hit, until we have an IR that would allow us to optimize bytecode better and do some rudimentary static type analysis to dispatch specialized bytecode instructions.
Here's a list of operators and their associated traits with methods, once that is finished:
Op
Trait
Method
infix ()
Call
call/n where n is the number of arguments in ()
prefix !
Not
not/0
prefix -
Negate
negate/0
infix *
Multiply
multiply/1
infix /
Divide
divide/1
infix +
Add
add/1
infix -
Subtract
subtract/1
infix ==
Equals
equals/1
infix !=
Equals
boolean NOT equals/1
infix <
Ordered
less/1
infix <=
Ordered
less_or_equal/1
infix >
Ordered
less/1 on the RHS
infix >=
Ordered
less_or_equal/1 on the RHS
. cannot be overloaded because it's magic for method lookups + calls. = cannot be overloaded because it's magic for assignments. and and or cannot be overloaded because they're magic for control flow.
The text was updated successfully, but these errors were encountered:
Once traits are implemented, it would make sense to make all the built-in operators dispatch to trait methods instead of magic bytecode. This does mean that for a few releases basic operations will take a performance hit, until we have an IR that would allow us to optimize bytecode better and do some rudimentary static type analysis to dispatch specialized bytecode instructions.
Here's a list of operators and their associated traits with methods, once that is finished:
()
Call
call/n
wheren
is the number of arguments in()
!
Not
not/0
-
Negate
negate/0
*
Multiply
multiply/1
/
Divide
divide/1
+
Add
add/1
-
Subtract
subtract/1
==
Equals
equals/1
!=
Equals
equals/1
<
Ordered
less/1
<=
Ordered
less_or_equal/1
>
Ordered
less/1
on the RHS>=
Ordered
less_or_equal/1
on the RHS.
cannot be overloaded because it's magic for method lookups + calls.=
cannot be overloaded because it's magic for assignments.and
andor
cannot be overloaded because they're magic for control flow.The text was updated successfully, but these errors were encountered: