Skip to content

Commit

Permalink
Improve documentation about bless.
Browse files Browse the repository at this point in the history
See issue #2077
  • Loading branch information
fluca1978 committed Jun 1, 2018
1 parent e8da29f commit 1220c5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/Type/Mu.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,15 @@ for more information.
method bless(*%attrinit --> Mu:D)
Lower-level object construction method than C<new>.
Low-level object construction method, usually called within C<new>.
Creates a new object of the same type as the invocant, uses
the named arguments to initialize attributes, and returns the
created object.
You can use this method when writing custom constructors:
It is usually invoked with custom C<new> method implementations:
=begin code
class Point {
has $.x;
has $.y;
Expand All @@ -284,6 +285,7 @@ You can use this method when writing custom constructors:
}
}
my $p = Point.new(-1, 1);
=end code
(Though each time you write a custom constructor, remember that it makes
subclassing harder).
Expand Down

0 comments on commit 1220c5e

Please sign in to comment.