Skip to content

Instantly share code, notes, and snippets.

Created February 28, 2016 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8a57e90a0499511f1ea8 to your computer and use it in GitHub Desktop.
Save anonymous/8a57e90a0499511f1ea8 to your computer and use it in GitHub Desktop.
diff --git a/doc/Language/objects.pod b/doc/Language/objects.pod
index 1e94d52..6e82e2a 100644
--- a/doc/Language/objects.pod
+++ b/doc/Language/objects.pod
@@ -462,6 +462,18 @@ positional arguments, you must write your own C<new> method:
However this is considered poor practice, because it makes correct
initialization of objects from subclasses harder.
+In contrast, providing a C<new> candidate with positional parameters that
+invokes the C<new> candidate from L<Any> isn't considered poor practice:
+
+ =for code :allow<B L>
+ class Point {
+ has $.x;
+ has $.y;
+ multi method new($x, $y) {
+ self.new(:$x, :$y)
+ }
+ }
+
Another thing to note is that the name C<new> is not special in Perl 6. It
is merely a common convention. You can call C<bless> from any method at all,
or use C<CREATE> to fiddle around with low-level workings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment