
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
54 lines
1.2 KiB
Plaintext
54 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Operator overloading is convenient but unfortunately not portable across languages. To be able to access the same functionality from another language you need to provide an alternate named method following the convention:
|
|
|
|
[frame=all]
|
|
[cols="^1,^1"]
|
|
|===
|
|
|Operator|Method Name
|
|
|
|
|``+`` (binary)|Add
|
|
|``++&++``|BitwiseAnd
|
|
|``++\|++``|BitwiseOr
|
|
|``++/++``|Divide
|
|
|``++==++``|Equals
|
|
|``++^++``|Xor
|
|
|``++>++``|Compare
|
|
|``++>=++``|Compare
|
|
|``++!=++``|Equals
|
|
|``++<++``|Compare
|
|
|``++<=++``|Compare
|
|
|``++!++``|LogicalNot
|
|
|``++%++``|Mod
|
|
|``++*++`` (binary)|Multiply
|
|
|``++~++``|OnesComplement
|
|
|``++-++`` (binary)|Subtract
|
|
|``++-++`` (unary)|Negate
|
|
|``+`` (unary)|Plus
|
|
|===
|
|
|
|
This rule raises an issue when there is an operator overload without the expected named alternative method.
|
|
|
|
|
|
=== Exceptions
|
|
|
|
This rule does not raise an issue when the class implementing the comparison operators ``++>++``, ``++<++``, ``++>=++`` and ``++<=++`` contains a method named ``++CompareTo++``.
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Implement alternative method 'xxx' for the operator 'yy'.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
Operator overload declaration
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|