routine defined
1 | class Junction |
1.1 | (Junction) method defined |
2 | class Mu |
2.1 | (Mu) method defined |
3 | class Mu |
3.1 | (Mu) routine defined |
4 | class Failure |
4.1 | (Failure) method defined |
Documentation for routine defined
assembled from the following types:
class Junction
From Junction
(Junction) method defined
Defined as:
multi method defined(Junction:)
Checks for definedness instead of Boolean values.
say ( 3 | Str).defined ; # OUTPUT: «True»say (one 3, Str).defined; # OUTPUT: «True»say (none 3, Str).defined; # OUTPUT: «False»
Failure
s are also considered non-defined:
my =Failure.new;say (one 3, ).defined; # OUTPUT: «True»
Since 6.d, this method will autothread.
class Mu
From Mu
(Mu) method defined
Declared as
multi method defined( --> Bool)
Returns False
on a type object, and True
otherwise.
say Int.defined; # OUTPUT: «False»say 42.defined; # OUTPUT: «True»
A few types (like Failure) override defined
to return False
even for instances:
sub fails() ;say fails().defined; # OUTPUT: «False»
class Mu
From Mu
(Mu) routine defined
Declared as
multi sub defined(Mu --> Bool)
invokes the .defined
method on the object and returns its result.
class Failure
From Failure
(Failure) method defined
Defined as:
multi method defined(Failure: --> Bool)
Returns False
(failures are officially undefined), and marks the failure as handled.
sub f() ; my = f; say .defined; # OUTPUT: «False»