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

Owner: Nobody
Requestors: smls75 [at] gmail.com
Cc:
AdminCc:

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



Subject: [BUG] Some forms of "dynamic symbol lookup" syntax cause compiler error in Rakudo
Download (untitled) / with headers
text/plain 1.3k
The behavior is different for the various syntax forms for looking up symbols dynamically: A) The [sigil at the start; null pseudo-package; name in curly or angle brackets] form throws an "Index out of bounds" error: $ perl6-m -e 'say defined $::{"foo"}' ===SORRY!=== MVMArray: Index out of bounds $ perl6-m -e 'say defined $::<foo>' ===SORRY!=== MVMArray: Index out of bounds $ perl6-m -e 'say defined &::<foo>' ===SORRY!=== MVMArray: Index out of bounds B) The [sigil at the start; *named* pseudo-package; name in curly or angle brackets] form fails with "Undeclared routine: &MY" or similar if the sigil is &, but works fine for other sigils: say defined &MY::{"foo"}' ===SORRY!=== Error while compiling -e Undeclared routine: &MY used at line 1 $ perl6-m -e 'say defined &MY::<foo>' ===SORRY!=== Error while compiling -e Undeclared routine: &MY used at line 1 $ perl6-m -e 'say defined $MY::<foo>' False C) The remaining forms seem to work fine. In particular all the ones that use parens instead of curly/angle brackets to look up the name: $ perl6 -e 'say .defined for &::("foo"), &MY::("foo"), $MY::("foo") False False False As well as the ones that treat the sigil as part of the name: $ perl6 -e 'say .defined for ::<$foo>, ::<&foo>, MY::<&foo>' False False False
As of today (2017.11,HEAD(e5b660e)) it gives this:

Show quoted text
===SORRY!=== Error while compiling -e
Variable '$' is not declared
at -e:1
------> say defined ⏏$::<foo>


There was another ticket that had exactly the same change of an error message, perhaps worth searching for it (ping me if you really want to find it).

On 2015-02-22 14:03:46, smls75@gmail.com wrote:
Show quoted text
> The behavior is different for the various syntax forms for looking up
> symbols dynamically:
>
> A) The [sigil at the start; null pseudo-package; name in curly or
> angle brackets] form throws an "Index out of bounds" error:
>
>
> $ perl6-m -e 'say defined $::{"foo"}'
> ===SORRY!===
> MVMArray: Index out of bounds
>
> $ perl6-m -e 'say defined $::<foo>'
> ===SORRY!===
> MVMArray: Index out of bounds
>
> $ perl6-m -e 'say defined &::<foo>'
> ===SORRY!===
> MVMArray: Index out of bounds
>
> B) The [sigil at the start; *named* pseudo-package; name in curly or
> angle brackets] form fails with "Undeclared routine: &MY" or similar
> if the sigil is &, but works fine for other sigils:
>
> say defined &MY::{"foo"}'
> ===SORRY!=== Error while compiling -e
> Undeclared routine:
> &MY used at line 1
>
> $ perl6-m -e 'say defined &MY::<foo>'
> ===SORRY!=== Error while compiling -e
> Undeclared routine:
> &MY used at line 1
>
> $ perl6-m -e 'say defined $MY::<foo>'
> False
>
> C) The remaining forms seem to work fine.
>
> In particular all the ones that use parens instead of curly/angle
> brackets to look up the name:
>
> $ perl6 -e 'say .defined for &::("foo"), &MY::("foo"), $MY::("foo")
> False
> False
> False
>
> As well as the ones that treat the sigil as part of the name:
>
> $ perl6 -e 'say .defined for ::<$foo>, ::<&foo>, MY::<&foo>'
> False
> False
> False




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