Documentation for method bless
assembled from the following pages:
Class: Mu §
From Mu
(Mu) method bless §
method bless(* --> Mu)
Low-level object construction method, usually called from within new
, implicitly from the default constructor, or explicitly if you create your own constructor. bless
creates a new object of the same type as the invocant, using the named arguments to initialize attributes and returns the created object.
It is usually invoked within custom new
method implementations:
my = Point.new(-1, 1);
In this example we are declaring this new
method to avoid the extra syntax of using pairs when creating the object. self.bless
returns the object, which is in turn returned by new
. new
is declared as a multi method
so that we can still use the default constructor like this: Point.new( x => 3, y => 8 )
.
For more details see the documentation on object construction.