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

Hyper method call of AT-KEY/AT-POS fails with empty arrays (my @x; say @x»[0]) #5978

Closed
p6rt opened this issue Jan 4, 2017 · 2 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Jan 4, 2017

Migrated from rt.perl.org#130503 (status was 'new')

Searchable as RT130503$

@p6rt
Copy link
Author

p6rt commented Jan 4, 2017

From @AlexDaniel

Code​:
my @​x; say @​x»[0]

Result​:
This type (Scalar) does not support elems
  in block <unit> at -e line 1

I think it should work (and should do nothing, as there are no elements in the array).

Here is an interesting thing. If you take, say, 2016.05 and try this​:

Code​:
my @​x; dd @​x; say @​x»[0]

Result (2016.05)​:
Array @​x = []
()

It works! But if you remove dd​:

Code​:
my @​x; say @​x»[0]

Result​:
This type (Scalar) does not support elems
  in block <unit> at /tmp/DPLGku74eh line 1

So it worked with dd, but didn't work without it. Weird. Anyway, this detail is probably not relevant anymore.

@raiph
Copy link

raiph commented Aug 22, 2021

Works in a recent Rakudo:

say $*RAKU;        # Raku (6.d)
my @x; say @x»[0]; # ()

@raiph raiph closed this as completed Aug 22, 2021
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

2 participants