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

LTA error message when referring to &1 in Rakudo #1499

Open
p6rt opened this issue Feb 15, 2010 · 16 comments
Open

LTA error message when referring to &1 in Rakudo #1499

p6rt opened this issue Feb 15, 2010 · 16 comments
Labels
Bug LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Feb 15, 2010

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

Searchable as RT72820$

@p6rt
Copy link
Author

p6rt commented Feb 15, 2010

From @masak

<diakopter> rakudo​: say &1
<p6eval> rakudo 70667a​: OUTPUT«Method 'postcircumfix​:<[ ]>' not found
for invocant of class '' [...]
<frettled> That one was slightly less than awesome.
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

From @coke

On Mon Feb 15 01​:22​:09 2010, masak wrote​:

<diakopter> rakudo​: say &1
<p6eval> rakudo 70667a​: OUTPUT«Method 'postcircumfix​:<[ ]>' not found
for invocant of class '' [...]
<frettled> That one was slightly less than awesome.
* masak submits rakudobug

Output is now​:

<Coke> rakudo​: say &1;
<p6eval> rakudo 2808a5​: OUTPUT«Any()␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

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

@p6rt
Copy link
Author

p6rt commented Sep 13, 2011

From @bbkr

NOM​:

bbkr​:nom bbkr$ ./perl6 -e 'say &1'
Nil

@p6rt
Copy link
Author

p6rt commented Sep 13, 2011

From @bbkr

[15​:03] <bbkr> masak​: what is the expected behavior in
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=72820 ?
[15​:04] <moritz> std​: &1
[15​:04] <p6eval> std bb4f150​: OUTPUT«ok 00​:01 121m␤»
[15​:05] <moritz> std​: &foo
[15​:06] <p6eval> std bb4f150​: OUTPUT«ok 00​:01 121m␤»
[15​:06] <benabik> &1? What's that mean? Does that return something
like `-> { return 1 }`?
[15​:06] <moritz> why doesn't that produce the same error as foo() ?
[15​:06] <moritz> benabik​: &foo returns a reference to the routine named
'foo'
[15​:06] <benabik> moritz​: Right. But I'm confused about it working on a
number.
[15​:06] <moritz> benabik​: so &1 would be a reference to a routine named '1'
[15​:07] <moritz> benabik​: and I'm confused about it not being a compile
time lookup
[15​:07] <benabik> std​: sub 1 { … }
[15​:07] <p6eval> std bb4f150​:
OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Malformed block at /tmp/SBxx_WovI3
line 1​:␤------> �[32msub �[33m⏏�[31m1 { … }�[0m␤ expecting any of​:␤
  name␤ routine_def␤ trait␤Parse failed␤FAILED 00​:01 117m␤»
[15​:07] <bbkr> you cannot name routine '1'
[15​:07] <benabik> std​: sub 1 { ... }
[15​:07] <p6eval> std bb4f150​:
OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Malformed block at /tmp/_zoQ8AtasP
line 1​:␤------> �[32msub �[33m⏏�[31m1 { ... }�[0m␤ expecting any of​:␤
name␤ routine_def␤ trait␤Parse failed␤FAILED 00​:01 117m␤»
[15​:07] <moritz> nom​: Q​:PIR { .lex '&1' }; say &1
[15​:07] <p6eval> nom d97997​: OUTPUT«Use of uninitialized value in string
context␤Use of uninitialized value in string
context␤===SORRY!===␤error​:imcc​:syntax error, unexpected '\n', expecting
COMMA␤ in file '(file unknown)' line 841␤␤»
[15​:07] <benabik> std​: sub '1' { ... }
[15​:07] <p6eval> std bb4f150​:
OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Malformed block at /tmp/U_Hs6qOCtu
line 1​:␤------> �[32msub �[33m⏏�[31m'1' { ... }�[0m␤ expecting any
of​:␤ name␤ routine_def␤ trait␤Parse failed␤FAILED 00​:01 117m␤»
[15​:08] <jnthn> std​: @​1
[15​:08] <p6eval> std bb4f150​: OUTPUT«ok 00​:01 118m␤»
[15​:08] <benabik> moritz​: The syntax for .lex is .lex <variable name>
<register>
[15​:08] <daxim> has anyone already written working shapely/eyedrops
style P6 programs? http://code.google.com/codejam/japan/tshirt.html
[15​:08] <moritz> nom​: Q​:PIR { .lex '&1' $P0 }; say &1
[15​:08] <p6eval> nom d97997​: OUTPUT«Use of uninitialized value in string
context␤Use of uninitialized value in string
context␤===SORRY!===␤error​:imcc​:syntax error, unexpected PREG, expecting
COMMA ('$P0')␤ in file '(file unknown)' line 137␤␤»
[15​:08] <jnthn> moritz​: I think it may be parsed as an accidental
side-effect of parsing $1, etc
[15​:08] <moritz> jnthn​: sounds plausible-ish
[15​:09] <-- colomon has left this server (Quit​: colomon).
[15​:09] <jnthn> nom​: "foo" ~~ /(f)/; say $0
[15​:09] <p6eval> nom d97997​: OUTPUT«f␤»
[15​:09] <jnthn> nom​: "foo" ~~ /(f)/; say @​0
[15​:09] <p6eval> nom d97997​: OUTPUT«f␤»
[15​:09] <jnthn> nom​: "foo" ~~ /(f)/; say &0
[15​:09] <p6eval> nom d97997​: OUTPUT«f␤»
[15​:09] <jnthn> heh :)
[15​:09] * moritz did that, probably
[15​:09] <moritz> jnthn++
[15​:09] <bbkr> so this ticket should be rejected as not a bug?
[15​:09] <jnthn> b​: "foo" ~~ /(f)/; say &0
[15​:09] <p6eval> b 1b7dd1​: OUTPUT«f␤»
[15​:09] <jnthn> moritz​: I think we may have always had it like that,
just never realized ;)
[15​:09] <moritz> ok, I just reused it :-)
[15​:10] <jnthn> .oO( let's call it a feature ;-) )
[15​:11] <jnthn> Guess a [ <?{ $<sigil> eq '$'}> <.panic​: '...'> ] or so
in the right place would catch it though.

@p6rt
Copy link
Author

p6rt commented Jul 6, 2016

From @zoffixznet

There was a bit of discussion today on this​: http://irclog.perlgeek.de/perl6/2016-07-06#i_12795274

Since the originally reported LTA error is gone, I'm going to close this. The 5-year old mold is starting to give off ;)

@p6rt
Copy link
Author

p6rt commented Jul 6, 2016

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

@p6rt
Copy link
Author

p6rt commented Jul 6, 2016

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

@p6rt
Copy link
Author

p6rt commented Mar 5, 2017

From @MasterDuke17

On Wed, 06 Jul 2016 10​:05​:13 -0700, cpan@​zoffix.com wrote​:

There was a bit of discussion today on this​:
http://irclog.perlgeek.de/perl6/2016-07-06#i_12795274

Since the originally reported LTA error is gone, I'm going to close
this. The 5-year old mold is starting to give off ;)

If you look at the log linked above it looks like a PR was going to be
submitted for this, but according to https://irclog.perlgeek.de/perl6-dev/2017-03-05#i_14208424
it didn't work, so this is still an open ticket.

@p6rt p6rt added the Bug label Jan 5, 2020
@MasterDuke17 MasterDuke17 added the LTA Less Than Awesome; typically an error message that could be better label Feb 8, 2020
@JJ
Copy link

JJ commented May 6, 2020

The logs have moved here. Still returns Nil, still should be invalid I would say this is still an open ticket.

@JJ
Copy link

JJ commented Dec 29, 2020

Ping?

@lizmat
Copy link
Contributor

lizmat commented Dec 29, 2020

@moritz if you could give me a hint where to look in Grammar for this, I could go in and fix this.

@moritz
Copy link

moritz commented Dec 29, 2020

$ perl6 --target=parse -e '&1'
- lang-version: 
- statementlist: &1
  - statement: 1 matches
    - EXPR: &1
      - variable: &1
        - sigil: &
        - index: 1

@lizmat so I'd begin searching in token variable and/or places where X::Undeclared is thrown.

@moritz
Copy link

moritz commented Dec 29, 2020

@lizmat thinking a bit more about, token variable is likely the wrong place to look. &-sigiled routines can be post-declared (code like say &foo; sub foo {} is valid), which means the token cannot take care of throwing the exception.

My approach would be to find out where a simple &foo exception is thrown, and then work backwards from there to find out why it doesn't apply to numeric &-sigiled vars.

@moritz
Copy link

moritz commented Dec 29, 2020

It seems the relevant code path is check_variable -> add_mystery and then later explain_mystery -> typed_sorry etc.

@JJ
Copy link

JJ commented May 16, 2021

Ping again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

5 participants