== multimethod

Methods

==(a:Any, b:Any)
Always false. Other == method implementations should compare types they understand. If none of them can handle the comparison, objects are considered non-equal.

Returns

false
==(a:Type, b:Type)
Compare types. Implemented as sameness comparison.

Example

type T1; type T2; T1==T2  # false
==(a:UserDefinedMethod, b:UserDefinedMethod)
Compare closures. Implemented as sameness comparison.

Example

F make_closure() { F(x) x + 1 }; make_closure()      == make_closure()       # false - different objects
F make_closure() { F(x) x + 1 }; make_closure().ip() == make_closure().ip()  # true - same code
f = F(x) x +1; f == f  # true - same instance
==(a:Real, b:Real)
Compare floating point numbers. Using this operator/function is not recommended.
==(a:Bool, b:Bool)
Compare booleans
==(a:Str, b:Str)
Compare strings
==(a:Int, b:Int)
Equality comparison
==(a:NormalTypeInstance, b:NormalTypeInstance) Source: stdlib.ngs:976
Equality test for normal type instances: must be of same type and have same fields and their values

Returns

Bool

Example

type T
t1 = T()
t1.a = 1
t2 = T()
t2.a = 1
echo(t1 == t2)  # Outputs: true
==(a:Null, b:Any) Source: stdlib.ngs:1364
Compare to null

Returns

false
==(a:Any, b:Null) Source: stdlib.ngs:1368
Compare to null

Returns

false
==(a:Null, b:Null) Source: stdlib.ngs:1372
Compare to null

Returns

true
==(a:Arr, b:Arr) Source: stdlib.ngs:1508
Arrays equality test. True if arrays are of the same length and all elements are equal (==)

Returns

Bool
==(a:Hash, b:Hash) Source: stdlib.ngs:2255
Compare two Hashes. Hashes must have same keys with same values in same order to return true.

Returns

Bool
==(b1:Box, b2:Box) Source: stdlib.ngs:2856
Compare boxes. Empty boxes and boxes with same content are considered to be equal.

Returns

Bool

Example

EmptyBox() == EmptyBox()
EmptyBox() != FullBox(1)
FullBox(1) == FullBox(1)
FullBox(1) != FullBox(2)
==(a:AWS::RouteBox, b:AWS::RouteBox)internal Source: autoload/AWS.ngs:404
Internal method. Please do not use.

Example

# TODO: example
==(a:AWS::IpPermBox, b:AWS::IpPermBox)internal Source: autoload/AWS.ngs:564
Internal method. Please do not use.
==(a:_RouteBox, b:_RouteBox)internal Source: autoload/AWS2.ngs:510
Internal method. Please do not use.

Example

# TODO: example
==(a:_IpPermBox, b:_IpPermBox)internal Source: autoload/AWS2.ngs:638
Internal method. Please do not use.