method new_type

Documentation for method new_type assembled from the following types:

class Metamodel::ClassHOW

From Metamodel::ClassHOW

(Metamodel::ClassHOW) method new_type

method (:$name:$repr = 'P6opaque':$ver:$auth)

Creates a new type from the metamodel, which we can proceed to build

my $type = Metamodel::ClassHOW.new_type(name => "NewType",
                                        ver => v0.0.1,
                                        auth => 'github:perl6' );
$type.HOW.add_method($type,"hey"method { say "Hey" });
$type.hey;     # OUTPUT: «Hey␤» 
my $instance = $;
$instance.hey# OUTPUT: «Hey␤» 

We add a single method by using Higher Order Workings methods, and then we can use that method directly as class method; we can then compose the type, following which we can create already an instance, which will behave in the exact same way.