Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

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

Open p6rt opened 14 years ago

p6rt commented 14 years ago

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

Searchable as RT72820$

p6rt commented 14 years ago

From @masak

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

p6rt commented 14 years ago

From @coke

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

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

Output is now​:

\ rakudo​: say &1; \ rakudo 2808a5​: OUTPUT«Any()␤»

-- Will "Coke" Coleda

p6rt commented 14 years ago

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

p6rt commented 13 years ago

From @bbkr

NOM​:

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

p6rt commented 13 years ago

From @bbkr

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

p6rt commented 8 years ago

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 commented 8 years ago

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

p6rt commented 8 years ago

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

p6rt commented 7 years ago

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.

JJ commented 4 years ago

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

JJ commented 3 years ago

Ping?

lizmat commented 3 years ago

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

moritz commented 3 years ago
$ 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 commented 3 years ago

@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 commented 3 years ago

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

JJ commented 3 years ago

Ping again?