method CALL-ME

Documentation for method CALL-ME assembled from the following types:

role Callable

From Callable

(Callable) method CALL-ME

method CALL-ME(Callable:D $self: |arguments)

This method is required for postfix:«( )» and postfix:«.( )». It's what makes an object actually call-able and needs to be overloaded to let a given object act like a routine. If the object needs to be stored in a &-sigiled container, is has to implement Callable.

class A does Callable {
    submethod CALL-ME(|c){ 'called' }
}
my &a = A;
say a(); # OUTPUT: «called␤»

role Enumeration

From Enumeration

(Enumeration) method CALL-ME

Defined as:

multi method CALL-ME(|)

Returns an Enumeration instance given an enum value.

enum Mass ( mg => 1/1000=> 1/1kg => 1000/1 );
say Mass(1/1000); # OUTPUT: mg