class RakuAST::Type::Capture { }

The RakuAST::Type::Capture class represents a stand-in Raku type with an optional type-smiley.

Object introspection§

RakuAST::Type::Capture object is typically created when parsing Raku Programming Language code. So most developers will only need to know how to introspect the objects created.

definite§

say $type.definite;  # True, False or Bool

Returns True if a defined constraint was indicated ("D"), False if a not defined constraint was indicated ("U"), or the Bool enum if no constraint was indicated ("_" or "" or no smiley).

name§

say $type.name;  # RakuAST::Name.from-identifier("foo")

Returns the L<RakuAST::Name>|/type/RakuAST::Name object of this RakuAST::Type::Capture object.

smiley§

say $type.smiley;  # "D", "U" or ""

Returns whatever was (possibly implicitly) specified with the .smiley named argument at object creation.

Object creation§

There are several ways to create a RakuAST::Type::Capture object. For simple identifiers it is recommended to use the alternate .from-identifier method to create a RakuAST::Type::Capture object. Otherwise one can use the standard .new method.

new§

my $type = RakuAST::Type::Capture.new(
  RakuAST::Name.from-identifier("D"),
  :smiley<D>
);
dd $type;  # ::T:D

Creates a RakuAST::Type::Capture object from the given RakuAST::Name object and an optional :smiley named argument that should be one of "D", "U", "_" or "".

from-identifier§

my $type = RakuAST::Type::Capture.from-identifier('T', 'D');
dd $type;  # ::T:D

Creates a RakuAST::Type::Capture object from the given simple identifier string, and an optional type-smiley string.

Typegraph§

Type relations for Type::RakuAST::type::Capture
Rakudo Type Relation for Capture Capture Capture Any Any Capture->Any is

Expand chart above