method raw
Documentation for method raw
assembled from the following types:
class Parameter
From Parameter
(Parameter) method raw
Defined as:
method raw(Parameter: --> Bool)
Returns True
for raw parameters.
sub f(, is raw, \c)f(17, "4711", 42); OUTPUT: «FalseTrueTrue»
Raw parameters bind either a variable or a value passed to it, with no decontainerization taking place. That means that if a variable was passed to it, you can assign to the parameter. This is different from rw-parameter which can only bind to variables, never to values.
This is the normal behavior for parameters declared with a sigil of '\'
, which is not really a sigil insofar as it is only used on the parameter.
sub f(\x)f(my ); # worksf(42); # diesCATCH ;# OUTPUT: «X::Assignment::RO: Cannot modify an immutable Int»
Other parameters may become raw through use of the 'is raw
' trait. These still use their sigil in code.
sub f( is raw)