Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slurpy params give "Cannot morph a Perl6Scalar." error #255

Closed
p6rt opened this issue Aug 22, 2008 · 12 comments
Closed

Slurpy params give "Cannot morph a Perl6Scalar." error #255

p6rt opened this issue Aug 22, 2008 · 12 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 22, 2008

Migrated from rt.perl.org#58278 (status was 'resolved')

Searchable as RT58278$

@p6rt
Copy link
Author

p6rt commented Aug 22, 2008

From @moritz

r30449​:

sub a(*@​b) { say @​b.elems }; a(1, 2, 3)
Cannot morph a Perl6Scalar.

Note that the passing itself doesn't throw an error​:

sub a(*@​b) { }; a(1, 2, 3)

Clearly we need more tests...

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

@p6rt
Copy link
Author

p6rt commented Aug 22, 2008

From @moritz

r30449​:

sub a(*@​b) { say @​b.elems }; a(1, 2, 3)
Cannot morph a Perl6Scalar.

Note that the passing itself doesn't throw an error​:

sub a(*@​b) { }; a(1, 2, 3)

Clearly we need more tests...

Now added test in t/spec/S06-signature/slurpy-params.t which rakudo all
fails

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

@p6rt
Copy link
Author

p6rt commented Sep 7, 2008

From @bacek

On Fri Aug 22 15​:39​:26 2008, moritz@​casella.verplant.org wrote​:

Now added test in t/spec/S06-signature/slurpy-params.t which rakudo all
fails

There is small patch, that makes first 6 tests from slurpy-params.t
pass. Unfortunately it brakes Exception passing as params.

So, question is​: "is this patch totally insane or we should add method
'item' to Exception?"

--
Bacek.

@p6rt
Copy link
Author

p6rt commented Sep 7, 2008

From @bacek

signature.patch
diff --git a/languages/perl6/src/parser/actions.pm b/languages/perl6/src/parser/actions.pm
index 349f433..8f76c67 100644
--- a/languages/perl6/src/parser/actions.pm
+++ b/languages/perl6/src/parser/actions.pm
@@ -1068,9 +1068,10 @@ method signature($/) {
                     ),
                     PAST::Op.new(
                         :inline(
-                            '    %r = new "Perl6Scalar", %0',
-                            '    $P0 = get_hll_global ["Bool"], "True"',
-                            '    setprop %r, "readonly", $P0'
+                            '    $P0 = %0."item"()',
+                            '    %r = new "Perl6Scalar", $P0',
+                            '    $P1 = get_hll_global ["Bool"], "True"',
+                            '    setprop %r, "readonly", $P1'
                         ),
                         PAST::Var.new(
                             :name($parameter.name()),
@@ -1089,8 +1090,7 @@ method signature($/) {
                     ),
                     PAST::Op.new(
                         :inline(
-                            '    %r = new "Perl6Scalar"',
-                            '    %r."infix:="(%0)'
+                            '    %r = clone %0'
                         ),
                         PAST::Var.new(
                             :name($parameter.name()),

@p6rt
Copy link
Author

p6rt commented Sep 7, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 9, 2008

From @bacek

Hello.

There is patch that fixes this error (and makes first 6 tests from
S06/slurpy-params.t passing). Unfortunately it triggers bug from #​58718

--
Bacek.

@p6rt
Copy link
Author

p6rt commented Sep 9, 2008

From @bacek

signature.patch
diff --git a/languages/perl6/src/parser/actions.pm b/languages/perl6/src/parser/actions.pm
index 349f433..27ddcd0 100644
--- a/languages/perl6/src/parser/actions.pm
+++ b/languages/perl6/src/parser/actions.pm
@@ -1068,7 +1068,8 @@ method signature($/) {
                     ),
                     PAST::Op.new(
                         :inline(
-                            '    %r = new "Perl6Scalar", %0',
+                            '    %r = new "Perl6Scalar"',
+                            '    %r."infix:="(%0)',
                             '    $P0 = get_hll_global ["Bool"], "True"',
                             '    setprop %r, "readonly", $P0'
                         ),
@@ -1089,8 +1090,7 @@ method signature($/) {
                     ),
                     PAST::Op.new(
                         :inline(
-                            '    %r = new "Perl6Scalar"',
-                            '    %r."infix:="(%0)'
+                            '    %r = clone %0'
                         ),
                         PAST::Var.new(
                             :name($parameter.name()),

@p6rt
Copy link
Author

p6rt commented Sep 9, 2008

From @bacek

Hello.

There is patch that fixes this error (and makes first 6 tests from
S06/slurpy-params.t passing). Unfortunately it triggers bug from #​58718

--
Bacek.

@p6rt
Copy link
Author

p6rt commented Sep 9, 2008

From @bacek

signature.patch
diff --git a/languages/perl6/src/parser/actions.pm b/languages/perl6/src/parser/actions.pm
index 349f433..27ddcd0 100644
--- a/languages/perl6/src/parser/actions.pm
+++ b/languages/perl6/src/parser/actions.pm
@@ -1068,7 +1068,8 @@ method signature($/) {
                     ),
                     PAST::Op.new(
                         :inline(
-                            '    %r = new "Perl6Scalar", %0',
+                            '    %r = new "Perl6Scalar"',
+                            '    %r."infix:="(%0)',
                             '    $P0 = get_hll_global ["Bool"], "True"',
                             '    setprop %r, "readonly", $P0'
                         ),
@@ -1089,8 +1090,7 @@ method signature($/) {
                     ),
                     PAST::Op.new(
                         :inline(
-                            '    %r = new "Perl6Scalar"',
-                            '    %r."infix:="(%0)'
+                            '    %r = clone %0'
                         ),
                         PAST::Var.new(
                             :name($parameter.name()),

@p6rt
Copy link
Author

p6rt commented Sep 9, 2008

From @pmichaud

Patch rejected; the patch appears to eliminate "Perl6Scalar"
entirely from the 'is copy' semantics, this means we'd be without
an appropriate Scalar container for something like

  sub foo($a is copy) { ... }

In general I think much of the signature handling in Rakudo needs
a significant refactor, so I'm a bit reluctant to apply small
tweaks until that happens.

Thanks!

Pm

@​@​ -1089,8 +1090,7 @​@​ method signature($/) {
),
PAST​::Op.new(
:inline(
- ' %r = new "Perl6Scalar"',
- ' %r."infix​:="(%0)'
+ ' %r = clone %0'
),
PAST​::Var.new(
:name($parameter.name()),

@p6rt
Copy link
Author

p6rt commented Dec 9, 2008

From @jnthn

On Fri Aug 22 15​:39​:26 2008, moritz@​casella.verplant.org wrote​:

r30449​:

sub a(*@​b) { say @​b.elems }; a(1, 2, 3)
Cannot morph a Perl6Scalar.

Note that the passing itself doesn't throw an error​:

sub a(*@​b) { }; a(1, 2, 3)

Clearly we need more tests...

Now added test in t/spec/S06-signature/slurpy-params.t which rakudo all
fails

We now pass all of them apart from the typed arrays one, which is a
separate issue, so making ticket resolved.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Dec 9, 2008

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Dec 9, 2008
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant