Overloaded operators: Difference between revisions

m
→‎{{header|Raku}}: more clarification
m (→‎{{header|Raku}}: further exposition)
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. OneOr ofit's theextremely foundingcommon... principlesIt ofdepends Rakuon ishow you view it.
 
One of the founding principles of Raku is that: "Different things should look different". It follows that "Similar things should look similar".
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 + operatormulti to add two Lines together, for some bogus definition of add
multi infix:<+> (Line $x, Line $y) {
Line.new(
10,333

edits