Skip Menu |
Report information
Id: 111674
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] Can't refer to a constant in RHS of the constant declaration in Rakudo
Date: Sun, 11 Mar 2012 17:22:02 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 621b
<masak> nom: constant catalan = 1, map { (4*$_ + 2) / ($_ + 2) * catalan[$_] }, 0..*; .say for catalan[^10] <p6eval> rakudo bd6fde: OUTPUT«===SORRY!===␤CHECK FAILED:␤Undefined routine '&catalan' called (line 1)␤» <masak> nom: constant k = 1, map { k[$_] }, 0..*; .say for k[^10] <p6eval> rakudo bd6fde: OUTPUT«===SORRY!===␤CHECK FAILED:␤Undefined routine '&k' called (line 1)␤» * masak submits rakudobug <masak> nom: constant k = k; say k <p6eval> rakudo bd6fde: OUTPUT«===SORRY!===␤Could not find sub &k␤» <masak> nom: constant k = 1; constant k2 = k; say k2 <p6eval> rakudo bd6fde: OUTPUT«1␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 593b
The error messages for the first two commands have changed slightly, but in the same way. I'm pasting the second example only: $ perl6 -e 'constant k = 1, map { k[$_] }, 0..*; .say for k[^10]' ===SORRY!=== Error while compiling -e Variable '&k' is not declared at -e:1 ------> constant k = 1, map { ⏏k[$_] }, 0..*; .say for k[^10] But on MoarVM and JVM the third example now gives a different (though LTA) error: $ perl6-m -e 'constant k = k; say k' ===SORRY!=== Cannot invoke this object (REPR: Null, cs = 0) $ perl6-j -e 'constant k = k; say k' ===SORRY!=== Can not invoke object '&k'
Still reproducible (2017.11,HEAD(e5b660e)). Now it complains early and the error is not as LTA:

Show quoted text
===SORRY!=== Error while compiling /tmp/zOO8XZsbYQ
Undeclared routine:
    k used at line 1

On 2015-03-10 05:18:33, bartolin@gmx.de wrote:
Show quoted text
> The error messages for the first two commands have changed slightly,
> but in the same way. I'm pasting the second example only:
>
> $ perl6 -e 'constant k = 1, map { k[$_] }, 0..*; .say for k[^10]'
> ===SORRY!=== Error while compiling -e
> Variable '&k' is not declared
> at -e:1
> ------> constant k = 1, map { ⏏k[$_] }, 0..*; .say for k[^10]
>
> But on MoarVM and JVM the third example now gives a different (though
> LTA) error:
>
> $ perl6-m -e 'constant k = k; say k'
> ===SORRY!===
> Cannot invoke this object (REPR: Null, cs = 0)
>
> $ perl6-j -e 'constant k = k; say k'
> ===SORRY!===
> Can not invoke object '&k'




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org