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

multiple return do not work properly in Rakudo #776

Closed
p6rt opened this issue Mar 16, 2009 · 5 comments
Closed

multiple return do not work properly in Rakudo #776

p6rt opened this issue Mar 16, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Mar 16, 2009

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

Searchable as RT63912$

@p6rt
Copy link
Author

p6rt commented Mar 16, 2009

From @ilyabelikin

Hi there,

sub foo { return ([1,2],3) }; my ($a, $b) = foo(); say $a; say $b;
1 2
3

sub foo { return ([1,2],3) }; my (@​a, $b) = foo(); say @​a; say $b;
1 23
Use of uninitialized value

part of discussion​:
Jonathan Worthington​: I guess if it's a signature binding, then the $b
would get the 3...
Jonathan Worthington​: So I think Rakudo may well be wrong here.
<...>
ihrd​: > sub foo { return 1,2 }; foo();
too many arguments passed (2) - at most 1 params expected
Jonathan Worthington​: hmm
ihrd​: I think this is error message not so informative
Jonathan Worthington​: Well, I think we just don't properly support
multiple return values.
Jonathan Worthington​: As in, unimplemented. That should eventually
work, not give any error.

Ilya

@p6rt
Copy link
Author

p6rt commented Jul 28, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S06-advanced_subroutine_features/return.t

commit b1229416777475b975a59f8a5f10b6aeddc6a6dc
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Tue Jul 28 02​:55​:40 2009 +0000

  [t/spec] Test for RT #​63912
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27765 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S06-advanced_subroutine_features/return.t b/t/spec/S06-advanced_subroutine_features/return.t
index ac69114..a7e0f67 100644
--- a/t/spec/S06-advanced_subroutine_features/return.t
+++ b/t/spec/S06-advanced_subroutine_features/return.t
@@ -15,7 +15,7 @@ See also t/blocks/return.t, which overlaps in scope.
 # reference for the spec for 'return', but I couldn't find
 # one either. 
 
-plan 76;
+plan 77;
 
 # These test the returning of values from a subroutine.
 # We test each data-type with 4 different styles of return.
@@ -321,4 +321,11 @@ is Foo::official(), 44,
     is $x, 1, 'get right value from sub with double ;';
 }
 
+# RT #63912
+{
+    sub rt63912 { return 1, 2; }
+    #?rakudo todo 'return wants just one argument?'
+    lives_ok { rt63912() }, 'can call sub that returns two things (no parens)';
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jul 28, 2009

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

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

From @moritz

multiple returns now work properly, and plenty of tests for them pass.

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

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

@p6rt p6rt closed this as completed Mar 9, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant