routine defined

Documentation for routine defined assembled from the following types:

class Mu

From Mu

(Mu) method defined

Declared as

multi method defined(   --> Bool:D)

Returns False on the type object, and True otherwise.

say Int.defined;                # OUTPUT: «False␤» 
say 42.defined;                 # OUTPUT: «True␤» 

Very few types (like Failure) override defined to return False even for instances:

sub fails() { fail 'oh noe' };
say fails().defined;            # OUTPUT: «False␤» 

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␤»