Overloaded operators: Difference between revisions
m
→{{header|Raku}}: more clarification
Thundergnat (talk | contribs) m (→{{header|Raku}}: further exposition) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: more clarification) |
||
Line 93:
=={{header|Raku}}==
While it is very easy to overload operators in Raku, it isn't really common...
at least, not in the traditional sense.
One of the founding principles of Raku is that: "Different things should look different". It follows that "Similar things should look similar".
To pick out one tiny example: Adding numbery things together shouldn't be easily confusable with concatenating
Line 156:
Unicode character or combination may used to define it. They may be infix,
prefix, postfix, (or post-circumfix!) The precedence, associativity and arity
are all easily defined. An operator at heart is just a subroutine with funny calling conventions.
Borrowed from the [[Nimber_arithmetic#Raku|Nimber arithmetic]] task:
Line 193:
}
# New infix +
multi infix:<+> (Line $x, Line $y) {
Line.new(
|