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

.sort called with space before the method operator returns a BOOTArray rather than List #4855

Closed
p6rt opened this issue Dec 15, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Dec 15, 2015

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

Searchable as RT126921$

@p6rt
Copy link
Author

p6rt commented Dec 15, 2015

From @smls

This causes 'for' loops and methods calls on it, to fail​:

  ➜ .say for <2 1 3> .sort
  Cannot find method 'map'​: no method cache and no .^find_method

  ➜ say (<2 1 3> .sort).elems
  Cannot find method 'elems'​: no method cache and no .^find_method

  ➜ say (<2 1 3> .sort).^methods.perl
  {}

  ➜ say (<2 1 3> .sort).WHAT
  ()

  ➜ say (<2 1 3> .sort).^name
  BOOTArray

Funnily enough, &say and .[] can still handle it​:

  ➜ say (<2 1 3> .sort)
  (1 2 3)

  ➜ say (<2 1 3> .sort)[0]
  1

On the other hand when the postfix form of the method call operator is used (i.e. no space before the .sort), the problem does not appear​:

  ➜ .say for <2 1 3>.sort
  1
  2
  3

  ➜ say (<2 1 3>.sort).WHAT
  (List)

@p6rt
Copy link
Author

p6rt commented Jul 30, 2016

From @lizmat

Fixed with 15ee3c3b9d94855aa , tests needed

On 15 Dec 2015, at 13​:57, Sam S. (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Sam S.
# Please include the string​: [perl #​126921]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126921 >

This causes 'for' loops and methods calls on it, to fail​:

➜ .say for <2 1 3> .sort
Cannot find method 'map'​: no method cache and no .^find_method

➜ say (<2 1 3> .sort).elems
Cannot find method 'elems'​: no method cache and no .^find_method

➜ say (<2 1 3> .sort).^methods.perl
{}

➜ say (<2 1 3> .sort).WHAT
()

➜ say (<2 1 3> .sort).^name
BOOTArray

Funnily enough, &say and .[] can still handle it​:

➜ say (<2 1 3> .sort)
(1 2 3)

➜ say (<2 1 3> .sort)[0]
1

On the other hand when the postfix form of the method call operator is used (i.e. no space before the .sort), the problem does not appear​:

➜ .say for <2 1 3>.sort
1
2
3

➜ say (<2 1 3>.sort).WHAT
(List)

@p6rt
Copy link
Author

p6rt commented Jul 30, 2016

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

@p6rt
Copy link
Author

p6rt commented Jul 30, 2016

From @zoffixznet

Tests added in Raku/roast@94d5bc99c3

--
Cheers,
ZZ | https://twitter.com/zoffix

@p6rt
Copy link
Author

p6rt commented Jul 30, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant