Documentation for trait is pure

Documentation for trait is pure, assembled from the following types:

class Routine

From Routine

(Routine) trait is pure

multi sub trait_mod:<is>(Routine $r:$pure!)

Marks a subroutine as pure, that is, it asserts that for the same input, it will always produce the same output without any additional side effects.

This is a promise by the programmer to the compiler that it can constant-fold calls to such functions when the arguments are known at compile time.

sub double(Numeric:D $xis pure {
    2 * $x;
}