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

Dereferencing an array constant #22100

Closed
philiprbrenan opened this issue Mar 25, 2024 · 3 comments
Closed

Dereferencing an array constant #22100

philiprbrenan opened this issue Mar 25, 2024 · 3 comments

Comments

@philiprbrenan
Copy link

philiprbrenan commented Mar 25, 2024

Given that line 3 works, would it not be reasonable to suppose that line 4 should work in the same way?

use v5.34;
$a = [1..2];
say STDERR @$a, " ", @{$a}, " ",  $a->@*, " ", @{[1..3]}, " ", [1..3]->@*; # 12 12 12 123 123                     - Line 3
say STDERR @[1..3];                                                        # Number found where operator expected - Line 4
@philiprbrenan philiprbrenan changed the title Derferncing an array constant Dereferencing an array constant Mar 25, 2024
@Grinnz
Copy link
Contributor

Grinnz commented Mar 25, 2024

The @{} syntax you demonstrated is required to dereference an expression, the only times the braces are not required are for simple variable names and scalars. This does not seem like a reasonable or useful addition to me, and you receive the error you do because it is currently parsed as the variable @[.

@mauke
Copy link
Contributor

mauke commented Mar 25, 2024

@Leont
Copy link
Contributor

Leont commented Mar 25, 2024

Philip, you keep posting these poorly thought-through ideas and we keep having to close them, this happened about two dozen times now. I hate saying this but maybe you should try doing something else because language design isn't your forte.

@Leont Leont closed this as completed Mar 25, 2024
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

4 participants