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

Cannot loop over a list of arrays with a junction or arrays in their midst in Rakudo #934

Closed
p6rt opened this issue Apr 24, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 24, 2009

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

Searchable as RT65096$

@p6rt
Copy link
Author

p6rt commented Apr 24, 2009

From @masak

<moritz_> rakudo​: for [1], [2]|[3], [4] -> @​a { say @​a.elems }
<p6eval> rakudo 9a5305​: OUTPUT«1␤Non-Positional argument or Positional
of wrong element type for @​a in call to _block34 [...]
<moritz_> bug?
<moritz_> don't know about junctions and arrays...
* masak submits, just in case

If the new standard is to not autothread in for loops, then this is in
fact in order. One might possibly want a more explanatory error
message, though, since the contents of the junction actually match the
signature.

@p6rt
Copy link
Author

p6rt commented Apr 28, 2009

From @jnthn

On Fri Apr 24 05​:02​:04 2009, masak wrote​:

<moritz_> rakudo​: for [1], [2]|[3], [4] -> @​a { say @​a.elems }
<p6eval> rakudo 9a5305​: OUTPUT«1␤Non-Positional argument or Positional
of wrong element type for @​a in call to _block34 [...]
<moritz_> bug?
<moritz_> don't know about junctions and arrays...
* masak submits, just in case

If the new standard is to not autothread in for loops, then this is in
fact in order. One might possibly want a more explanatory error
message, though, since the contents of the junction actually match the
signature.

The new standard is that the default type in pointy blocks is Object,
but Positional is a narrower type than that and thus auto-threading
should happen. A side-effect of clearing up error handling that I did
earlier today means that we do now hit the junction fallback, which is
good and essentially resolves the issue in this ticket. I guess a good
test case is​:

sub foo(@​a) { say @​a.elems }
foo([1,2]|[3,4,5])
2
3

Which works now. However, there are still issues with auto-threading and
pointy blocks, as described in RT#​63686, that make the original example
not quite work.

Thus I am assigning this ticket to moritz++ to request tests of the form
I put above (for auto-threading over a junction of hashes too would be
good), and suggest afterwards it's either closed or merged into 63686.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Apr 28, 2009

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

@p6rt
Copy link
Author

p6rt commented Apr 29, 2009

From @moritz

Tests are now in S03-junctions/autothreading.t.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Apr 29, 2009

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

@p6rt p6rt closed this as completed Apr 29, 2009
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