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

namespace clashes #5744

Closed
p6rt opened this issue Oct 12, 2016 · 6 comments
Closed

namespace clashes #5744

p6rt opened this issue Oct 12, 2016 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Oct 12, 2016

Migrated from rt.perl.org#129856 (status was 'resolved')

Searchable as RT129856$

@p6rt
Copy link
Author

p6rt commented Oct 12, 2016

From @MARTIMM

Hi,

I wanted to define a class in the 'Pod' package like so (in file
lib/Pod/Render.pm6)

use Pod​::To​::HTML;
unit package Pod;
class Render {
  # ...
}

Then use it

use Pod​::Render;
my Pod​::Render $pr .= new;

Throws the exception

===SORRY!===
Type 'Pod​::Render' is not declared
at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6​:10
------> my Pod​::Render⏏ $pr .= new;
Malformed my
at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6​:10
------> my Pod​::⏏Render $pr .= new;

I expect it to instantiate without problems as seen in my other projects.

When the declaration becomes like below, everything goes well.

use Pod​::To​::HTML;
class Pod​::Render {

}

Greetings,
Marcel

@p6rt
Copy link
Author

p6rt commented Oct 12, 2016

From @zoffixznet

I've narrowed down the issue to this condition​: if the package's name is part something that we already have in core, then this bug (is it a bug?) appears​:

No names to clash with core types; everything works​:
  $ cat Foo.pm6
  unit package Bar;
  class Ber {}
  $ perl6 -I. -MFoo -e 'say Bar​::Ber'
  (Ber)

Now package, as Op's, clashes with core Pod​:: namespace the issue is there​:
  $ cat Foo.pm6
  unit package Pod;
  class Ber {}
  $ perl6 -I. -MFoo -e 'say Pod​::Ber'
  Could not find symbol '&Ber'
  in block <unit> at -e line 1

And this can be reproduced if we clash with something else, like IO role​:
  $ cat Foo.pm6
  unit package IO;
  class Ber {}
  $ perl6 -I. -MFoo -e 'say IO​::Ber'
  Could not find symbol '&Ber'
  in block <unit> at -e line 1

On Wed Oct 12 07​:07​:19 2016, mt1957@​gmail.com wrote​:

Hi,

I wanted to define a class in the 'Pod' package like so (in file
lib/Pod/Render.pm6)

use Pod​::To​::HTML;
unit package Pod;
class Render {
# ...
}

Then use it

use Pod​::Render;
my Pod​::Render $pr .= new;

Throws the exception

===SORRY!===
Type 'Pod​::Render' is not declared
at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6​:10
------> my Pod​::Render⏏ $pr .= new;
Malformed my
at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6​:10
------> my Pod​::⏏Render $pr .= new;

I expect it to instantiate without problems as seen in my other projects.

When the declaration becomes like below, everything goes well.

use Pod​::To​::HTML;
class Pod​::Render {

}

Greetings,
Marcel

@p6rt
Copy link
Author

p6rt commented Oct 12, 2016

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

@p6rt
Copy link
Author

p6rt commented Oct 12, 2016

@p6rt
Copy link
Author

p6rt commented Sep 14, 2017

From @skids

On Wed, 12 Oct 2016 07​:07​:19 -0700, mt1957@​gmail.com wrote​:

Hi,

I wanted to define a class in the 'Pod' package like so (in file
lib/Pod/Render.pm6)

use Pod​::To​::HTML;
unit package Pod;
class Render {
# ...
}

Then use it

use Pod​::Render;
my Pod​::Render $pr .= new;

Throws the exception

===SORRY!===
Type 'Pod​::Render' is not declared
at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6​:10
------> my Pod​::Render⏏ $pr .= new;
Malformed my
at /home/marcel/Languages/Perl6/Projects/pod-render/bin/pod-render.pl6​:10
------> my Pod​::⏏Render $pr .= new;

I expect it to instantiate without problems as seen in my other projects.

When the declaration becomes like below, everything goes well.

use Pod​::To​::HTML;
class Pod​::Render {

}

Greetings,
Marcel

This appears to have been fixed. Tests added in roast commit 6e5180e96, so resolving.

@p6rt
Copy link
Author

p6rt commented Sep 14, 2017

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

@p6rt p6rt closed this as completed Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant