Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created February 16, 2017 14:42
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 zoffixznet/ecdb9f893faff9580da5055ab64f5760 to your computer and use it in GitHub Desktop.
Save zoffixznet/ecdb9f893faff9580da5055ab64f5760 to your computer and use it in GitHub Desktop.
cpan@perlbuild2~/CPANPRC/rakudo (nom)$ gd
diff --git a/src/core/Array.pm b/src/core/Array.pm
index 13f430a..d9b464e 100644
--- a/src/core/Array.pm
+++ b/src/core/Array.pm
@@ -47,7 +47,7 @@ my class Array { # declared in BOOTSTRAP
}
}
- method clone { [self] }
+ multi method clone(Array:D:) { [self] }
method iterator(Array:D:) {
diff --git a/src/core/Mu.pm b/src/core/Mu.pm
index ca266cf..8a0c2ab 100644
--- a/src/core/Mu.pm
+++ b/src/core/Mu.pm
@@ -622,7 +622,8 @@ my class Mu { # declared in BOOTSTRAP
SELF.^can($name)
}
- method clone(*%twiddles) {
+ proto method clone (|) { * }
+ multi method clone(*%twiddles) {
my $cloned := nqp::clone(self);
if %twiddles.elems {
for self.^attributes.flat -> $attr {
cpan@perlbuild2~/CPANPRC/rakudo (nom)$ ./perl6 -e 'Array.clone'
Cannot look up attributes in a Array type object
in block <unit> at -e line 1
cpan@perlbuild2~/CPANPRC/rakudo (nom)$ ./perl6 -e 'Cool.clone'
cpan@perlbuild2~/CPANPRC/rakudo (nom)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment