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

When class D::E is defined before class D, having just one of them declared in 'my' scope apparently erases D::E #4486

Open
p6rt opened this issue Aug 24, 2015 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 24, 2015

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

Searchable as RT125891$

@p6rt
Copy link
Author

p6rt commented Aug 24, 2015

From @ShimmerFairy

  $ perl6 -e 'class D​::E { method foo { "foo" } }; class D { method bar { "bar" } }; say D.bar; say D​::E.foo'
  bar
  foo
  $ perl6 -e 'my class D​::E { method foo { "foo" } }; class D { method bar { "bar" } }; say D.bar; say D​::E.foo'
  bar
  Could not find symbol '&E'
  in block <unit> at -e​:1

  Actually thrown at​:
  in block <unit> at -e​:1
  $ perl6 -e 'class D​::E { method foo { "foo" } }; my class D { method bar { "bar" } }; say D.bar; say D​::E.foo'
  bar
  Could not find symbol '&E'
  in block <unit> at -e​:1

  Actually thrown at​:
  in block <unit> at -e​:1
  $ perl6 -e 'my class D​::E { method foo { "foo" } }; my class D { method bar { "bar" } }; say D.bar; say D​::E.foo'
  bar
  Could not find symbol '&E'
  in block <unit> at -e​:1

  Actually thrown at​:
  in block <unit> at -e​:1

But put D before D​::E :

  $ perl6 -e 'class D { method bar { "bar" } }; class D​::E { method foo { "foo" } }; say D.bar; say D​::E.foo'
  bar
  foo
  $ perl6 -e 'my class D { method bar { "bar" } }; class D​::E { method foo { "foo" } }; say D.bar; say D​::E.foo'
  bar
  foo
  $ perl6 -e 'class D { method bar { "bar" } }; my class D​::E { method foo { "foo" } }; say D.bar; say D​::E.foo'
  bar
  foo
  $ perl6 -e 'my class D { method bar { "bar" } }; my class D​::E { method foo { "foo" } }; say D.bar; say D​::E.foo'
  bar
  foo

As discovered by YuriPanda at http://irclog.perlgeek.de/perl6/2015-08-24#i_11109804 , what's shown above appears to be the root of the issue.

@p6rt
Copy link
Author

p6rt commented Aug 24, 2015

From @labster

I think I discovered this 3 years ago. And if I recall correctly, the answer was something like DIHWIDT. Maybe a real bug, but I don't feel confident about expecting a leaf of a namespace to still exist after you redefined the root node.

Consider doing this instead​:
perl6 -e 'class D { ... }; my class D​::E { method foo { "foo" } }; class D { method bar { "bar" } }; say D.bar; say D​::E.foo'
bar
foo

On Mon Aug 24 16​:36​:44 2015, lue wrote​:

$ perl6 -e 'class D​::E { method foo { "foo" } }; class D { method bar
{ "bar" } }; say D.bar; say D​::E.foo'
bar
foo
$ perl6 -e 'my class D​::E { method foo { "foo" } }; class D { method
bar { "bar" } }; say D.bar; say D​::E.foo'
bar
Could not find symbol '&E'
in block <unit> at -e​:1

Actually thrown at​:
in block <unit> at -e​:1
$ perl6 -e 'class D​::E { method foo { "foo" } }; my class D { method
bar { "bar" } }; say D.bar; say D​::E.foo'
bar
Could not find symbol '&E'
in block <unit> at -e​:1

Actually thrown at​:
in block <unit> at -e​:1
$ perl6 -e 'my class D​::E { method foo { "foo" } }; my class D {
method bar { "bar" } }; say D.bar; say D​::E.foo'
bar
Could not find symbol '&E'
in block <unit> at -e​:1

Actually thrown at​:
in block <unit> at -e​:1

But put D before D​::E :

$ perl6 -e 'class D { method bar { "bar" } }; class D​::E { method foo
{ "foo" } }; say D.bar; say D​::E.foo'
bar
foo
$ perl6 -e 'my class D { method bar { "bar" } }; class D​::E { method
foo { "foo" } }; say D.bar; say D​::E.foo'
bar
foo
$ perl6 -e 'class D { method bar { "bar" } }; my class D​::E { method
foo { "foo" } }; say D.bar; say D​::E.foo'
bar
foo
$ perl6 -e 'my class D { method bar { "bar" } }; my class D​::E {
method foo { "foo" } }; say D.bar; say D​::E.foo'
bar
foo

As discovered by YuriPanda at http://irclog.perlgeek.de/perl6/2015-08-
24#i_11109804 , what's shown above appears to be the root of the
issue.

@p6rt
Copy link
Author

p6rt commented Aug 24, 2015

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

@p6rt p6rt added the oo label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant