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

bad error message laceholder variable @_ may not be used here because the surrounding block takes no signature #4349

Closed
p6rt opened this issue Jun 25, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 25, 2015

Migrated from rt.perl.org#125485 (status was 'rejected')

Searchable as RT125485$

@p6rt
Copy link
Author

p6rt commented Jun 25, 2015

From anteusz@freemail.hu

Hi,
Compile this and you get and error message

===SORRY!=== Error while compiling D​:\m\p6\perltidy\bug2.p6
Placeholder variable @​_ may not be used here because the surrounding
block takes no signature

sub dump_array {

  say "({join ')(',@​_})\n";
}

Compile this and you do not

sub dump_array {
  my @​d = @​_;
  say "({join ')(',@​d})\n";
}

Marton

@p6rt
Copy link
Author

p6rt commented Jun 25, 2015

From @FROGGS

Yes, that is a bug.

Rakudo believes that an interpolated block in a string is like a "real" block in code.
So it thinks that the @​_ was meant for the block in the string rather than the block the string is in.

@p6rt
Copy link
Author

p6rt commented Jun 25, 2015

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

@p6rt
Copy link
Author

p6rt commented Jul 22, 2015

From @moritz

On Thu Jun 25 05​:17​:47 2015, FROGGS.de wrote​:

Yes, that is a bug.

Rakudo believes that an interpolated block in a string is like a
"real" block in code.
So it thinks that the @​_ was meant for the block in the string rather
than the block the string is in.

I'd argue that Rakudo behaves correctly here, and STD.pm6 agrees too.
I see no indication that blocks inside a string are supposed to be any less "real" than blocks outside of strings.

What we observe here is the danger of implicit declarations​: They stop working for non-trivial cases. Your proper formal parameters for anything more involved.

Cheers,
Moritz

@p6rt p6rt closed this as completed Jul 22, 2015
@p6rt
Copy link
Author

p6rt commented Jul 22, 2015

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

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