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

error message when using the wrong sigil with an @array or %hash #4276

Closed
p6rt opened this issue May 29, 2015 · 6 comments
Closed

error message when using the wrong sigil with an @array or %hash #4276

p6rt opened this issue May 29, 2015 · 6 comments
Labels
LTA Less Than Awesome; typically an error message that could be better testneeded

Comments

@p6rt
Copy link

p6rt commented May 29, 2015

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

Searchable as RT125277$

@p6rt
Copy link
Author

p6rt commented May 29, 2015

From @hoelzro

For example​:

my @​array = 1, 2, 3;
my %hash = :foo(1), :bar(2);

say $array[0]; # Variable '$array' is not declared. Did you mean any of these?

say $hash{'foo'}; # Variable '$hash' is not declared. Did you mean any of these?

say $hash<foo>; # Variable '$hash' is not declared. Did you mean any of these?

Granted, these error messages could be worse, but I think a "hey, I see you're used to Perl 5"-style message could be useful.

@p6rt
Copy link
Author

p6rt commented Jul 7, 2016

From @coke

On Fri May 29 07​:28​:12 2015, rob@​hoelz.ro wrote​:

For example​:

my @​array = 1, 2, 3;
my %hash = :foo(1), :bar(2);

say $array[0]; # Variable '$array' is not declared. Did you mean any
of these?

say $hash{'foo'}; # Variable '$hash' is not declared. Did you mean
any of these?

say $hash<foo>; # Variable '$hash' is not declared. Did you mean any
of these?

Granted, these error messages could be worse, but I think a "hey, I
see you're used to Perl 5"-style message could be useful.

I'm happy enough with the message pointing to the correct variable name here​:

Variable '$array' is not declared. Did you mean any of these?
  @​array
  Array
  array

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 7, 2016

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

@p6rt
Copy link
Author

p6rt commented Oct 3, 2017

From @AlexDaniel

Yes, I'm happy with it too. No need for perl 5 error message here (also, please, let's have less perl 5 error messages).

testneeded.

Also, here's how the error message was changing over time​: https://gist.github.com/Whateverable/2373e732b2c3c10f643fa8eb5c5470a7

On 2016-07-07 06​:52​:35, coke wrote​:

On Fri May 29 07​:28​:12 2015, rob@​hoelz.ro wrote​:

For example​:

my @​array = 1, 2, 3;
my %hash = :foo(1), :bar(2);

say $array[0]; # Variable '$array' is not declared. Did you mean
any
of these?

say $hash{'foo'}; # Variable '$hash' is not declared. Did you mean
any of these?

say $hash<foo>; # Variable '$hash' is not declared. Did you mean
any
of these?

Granted, these error messages could be worse, but I think a "hey, I
see you're used to Perl 5"-style message could be useful.

I'm happy enough with the message pointing to the correct variable
name here​:

Variable '$array' is not declared. Did you mean any of these?
@​array
Array
array

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

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

@p6rt p6rt closed this as completed Dec 12, 2017
@p6rt p6rt added LTA Less Than Awesome; typically an error message that could be better testneeded labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better testneeded
Projects
None yet
Development

No branches or pull requests

1 participant