routine defined

Documentation for routine defined assembled from the following types:

class Junction

From Junction

(Junction) method defined

Defined as:

multi method defined(Junction:D:)

Checks for definedness instead of Boolean values.

say ( 3 | Str).defined ;   # OUTPUT: «True␤» 
say (one 3Str).defined;  # OUTPUT: «True␤» 
say (none 3Str).defined# OUTPUT: «False␤»

Failures are also considered non-defined:

my $foo=Failure.new;
say (one 3$foo).defined# OUTPUT: «True␤»

Since 6.d, this method will autothread.

class Mu

From Mu

(Mu) routine defined

Declared as

multi sub defined(Mu --> Bool:D)

invokes the .defined method on the object and returns its result.

class Failure

From Failure

(Failure) method defined

Defined as:

multi method defined(Failure:D: --> Bool:D)

Returns False (failures are officially undefined), and marks the failure as handled.

sub f() { fail }my $v = fsay $v.defined# OUTPUT: «False␤»