BrowserREPL-button-tip-on BrowserREPL-button-tip-off

EditButtonTip 2026-10-04

class RakuAST::Type::Definedness

Represent a Raku type that constrains on (un)defined

class RakuAST::Type::Definedness { }
Code

The RakuAST::Type::Definedness class represents a Raku type that constrains on (un)defined.

Object introspection§

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

is-coercive§

say $type.is-coercive;  # True
Code

The is-coercive method returns True if the base-type is coercive.

name§

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

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

Object creation§

There is only one way to create a RakuAST::Type::Definedness object.

new§

my $type = RakuAST::Type::Definedness.new(
  base-type => RakuAST::Type::Simple.from-identifier("Int"),
  definite  => True
);
dd $type;  # Int:D
Code

The .new method creates a RakuAST::Type::Definedness object. It expects the following named arguments:

  • :base-type - RakuAST::Type object for the base type (required)
  • :definite - True/False (required)