Documentation for routine defined

Documentation for routine defined, assembled from the following types:

class Mu

From Mu

(Mu) routine defined

multi sub    defined(Mu --> Bool:D)
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 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␤»