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

Some forms of "dynamic symbol lookup" syntax cause compiler error in Rakudo #3698

Open
p6rt opened this issue Feb 22, 2015 · 3 comments
Open

Some forms of "dynamic symbol lookup" syntax cause compiler error in Rakudo #3698

p6rt opened this issue Feb 22, 2015 · 3 comments
Labels
Bug

Comments

@p6rt
Copy link

@p6rt p6rt commented Feb 22, 2015

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

Searchable as RT123903$

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Feb 22, 2015

From @smls

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

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Dec 3, 2017

From @AlexDaniel

As of today (2017.11,HEAD(e5b660e)) it gives this​:

===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​:

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

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Dec 3, 2017

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

@p6rt p6rt added the Bug 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
1 participant
You can’t perform that action at this time.