routine ===
1 | language documentation Operators |
1.1 | (Operators) infix === |
2 | role Enumeration |
2.1 | (Enumeration) method === |
Documentation for routine ===
assembled from the following types:
language documentation Operators
From Operators
(Operators) infix ===
sub infix:<===>(Any, Any)
Value identity operator. Returns True
if both arguments are the same object, disregarding any containerization.
my ;my = A.new;say === ; # OUTPUT: «True»say A.new === A.new; # OUTPUT: «False»say A === A; # OUTPUT: «True»
For value types, ===
behaves like eqv
:
say 'a' === 'a'; # OUTPUT: «True»say 'a' === 'b'; # OUTPUT: «False»my = 'a';say === 'a'; # OUTPUT: «True»# different typessay 1 === 1.0; # OUTPUT: «False»
===
uses the WHICH method to obtain the object identity.
If you want to create a class that should act as a value type, then that class must create an instance method WHICH
, that should return a ValueObjAt object that won't change for the lifetime of the object.
role Enumeration
From Enumeration
(Enumeration) method ===
Defined as
multi infix:<===> (Enumeration \a, Enumeration \b)
Equality of Enumeration
symbols:
say Norse-gods.pick() === Freija for ^3; # OUTPUT: «FalseFalseTrue»