class RakuAST::Type::Parameterized
class RakuAST::Type::Parameterized { }
The RakuAST::Type::Parameterized class represents a Raku type with
parameterization.
Object introspection
RakuAST::Type::Parameterized object is typically created when parsing
Raku Programming Language code. So most developers will only need to
know how to introspect the objects created.
args
dd $type.args; # Str
The args method returns the
RakuAST::ArgList object that was specified
with the (possibly implicit) "args" named argument in the call to .new.
base-type
dd $type.base-type; # Int
The base-type method returns the RakuAST::Type object that was
specified with the "base-type" named argument in the call to .new.
is-coercive
say $type.is-coercive; # True or False
The is-coercive method returns whether the base-type is coercive.
Object creation
There is only one way to create a RakuAST::Type::Parameterized object.
new
my $type = RakuAST::Type::Parameterized.new(
base-type => RakuAST::Type::Simple.from-identifier("Int"),
args => RakuAST::ArgList.new(
RakuAST::Type::Simple.from-identifier("Str")
)
);
dd $type; # Int(Str)
The .new method creates a RakuAST::Type::Parameterized object. It
expects the following named arguments:
:base-type - RakuAST::Type object for the base type (required)
:args - RakuAST::ArgList object (optional, default: no arguments)