Documentation for infix but
Documentation for infix but, assembled from the following types:
multi sub infix:<but>(Mu , Mu ) is assoc<non>multi sub infix:<but>(Mu , Mu ) is assoc<non>
Creates a copy of
$role mixed in. Since
$obj is not modified,
but can be used to created immutable values with mixins.
Instead of a role, you can provide an instantiated object. In this case, the operator will create a role for you automatically. The role will contain a single method named the same as
$obj.^name and that returns
say 42 but 'forty two'; # OUTPUT: «forty two␤»my = 12 but .new;say .Warbles.hi; # OUTPUT: «hello␤»say + 42; # OUTPUT: «54␤»
If methods of the same name are present already, the last mixed in role takes precedence. A list of methods can be provided in parentheses separated by comma. In this case conflicts will be reported at runtime.