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 triple colon in variable names (my $foo:::_) #5311

Open
p6rt opened this issue May 11, 2016 · 5 comments
Open

error message when using triple colon in variable names (my $foo:::_) #5311

p6rt opened this issue May 11, 2016 · 5 comments
Labels
LTA

Comments

@p6rt
Copy link

@p6rt p6rt commented May 11, 2016

Migrated from rt.perl.org#128120 (status was 'open')

Searchable as RT128120$

@p6rt
Copy link
Author

@p6rt p6rt commented May 11, 2016

From @AlexDaniel

… Wait, you can use colons in variable names?… Anyway​:

Code​:
my $foo​::​:_ = 42; say $foo_​::​:_

Result​:
===SORRY!=== Error while compiling -e
Variable '$foo_​:_' is not declared. Did you mean '$foo​::​:_'?
at -e​:1
------> my $foo​::​:_ = 42; say $foo_​::​:_

Well, yes, I meant '$foo​::​:_'. In fact, that's exactly what I wrote.

Related discussion about colons here​: Raku/old-design-docs#106

@p6rt
Copy link
Author

@p6rt p6rt commented May 11, 2016

From @zoffixznet

First, the code in OP has a typo. The variable names are the same, but the error is wrong.

But to add to the discussion on colons. It seems it's an artifact from allowing the namespace double-colons, and they should not be permitted for use the same as hyphens or apostrophes. There's a whole bunch of abuse examples in this log​: http://irclog.perlgeek.de/perl6/2016-05-11#i_12461836

Especially note that my $x​:foo works, but my \x​:foo doesn't.

@p6rt
Copy link
Author

@p6rt p6rt commented May 11, 2016

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

@p6rt
Copy link
Author

@p6rt p6rt commented May 11, 2016

From @AlexDaniel

Because I screwed up the example in the bug report, here is a proper one​:

Code​:
my $foo_​::​:_ = 42; say $foo_​::​:_

Result​:
===SORRY!=== Error while compiling -e
Variable '$foo_​:_' is not declared. Did you mean '$foo_​::​:_'?
at -e​:1
------> my $foo_​::​:_ = 42; say $foo_​::​:_

However, let's add more wtfness to this bug report​:

Code​:
my $foo_​:_ = 42; say $foo_​::​:_

Result​:
42

@p6rt
Copy link
Author

@p6rt p6rt commented May 11, 2016

From 1parrota@gmail.com

The appropriate error message for this would be "Really stupid
variable name! Don't do things like that".

On 5/10/16, Alex Jakimenko <perl6-bugs-followup@​perl.org> wrote​:

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

… Wait, you can use colons in variable names?… Anyway​:

Code​:
my $foo​::​:_ = 42; say $foo_​::​:_

Result​:
===SORRY!=== Error while compiling -e
Variable '$foo_​:_' is not declared. Did you mean '$foo​::​:_'?
at -e​:1
------> my $foo​::​:_ = 42; say $foo_​::​:_

Well, yes, I meant '$foo​::​:_'. In fact, that's exactly what I wrote.

Related discussion about colons here​:
Raku/old-design-docs#106

@p6rt p6rt added the LTA label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.