Navigation Menu

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

Different semantics in multi vs sub #1859

Closed
p6rt opened this issue Jun 20, 2010 · 5 comments
Closed

Different semantics in multi vs sub #1859

p6rt opened this issue Jun 20, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 20, 2010

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

Searchable as RT75900$

@p6rt
Copy link
Author

p6rt commented Jun 20, 2010

From @jnthn

This may, or may not, be a case of the closures bug, but​:

use v6;

my @​my-array = 4,2,3,4;

multi sub fsort([$p?,*@​r]) {
  return fsort(@​r.grep( {$_ <= $p} )),$p,fsort(@​r.grep( {$_ > $p} )) if $p || @​r;
}

say fsort(@​my-array).join(' ');

Works, and removing the "multi" breaks it.

Jonathan

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

From @coke

On Sun Jun 20 13​:50​:41 2010, jnthn@​jnthn.net wrote​:

This may, or may not, be a case of the closures bug, but​:

use v6;

my @​my-array = 4,2,3,4;

multi sub fsort([$p?,*@​r]) {
return fsort(@​r.grep( {$_ <= $p} )),$p,fsort(@​r.grep( {$_ > $p} ))
if $p || @​r;
}

say fsort(@​my-array).join(' ');

Works, and removing the "multi" breaks it.

Jonathan

This now works both ways. assigning to moritz++ for test coverage.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

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

@p6rt
Copy link
Author

p6rt commented Aug 8, 2010

From @moritz

Now tested in t/spec/S06-signature/unpack-array.t

@p6rt
Copy link
Author

p6rt commented Aug 8, 2010

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

@p6rt p6rt closed this as completed Aug 8, 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