[PUGS] 'is export' trait

1 view

Garrett Rooney

May 1, 2005, 5:44:03 PM5/1/05
to perl6-c...@perl.org
I might have this wrong, but isn't the 'is export' trait on a subroutine
supposed to indicate that it's exported into the namespace of the code
that uses or requires the module? That doesn't seem to be happening
right now. Well, it is happening, but it's also happening for
subroutines without that trait, and that seems wrong.

For example, if I have the following files:

Foo.pm

module Foo-0.0.1;
use v6;

# note the lack of 'is export'...
sub bar {
say "Foo::bar";
}

foo.p6

use v6;
use Foo;

bar();

I'd assume this should be an error, since bar isn't exported, but it's
not, running the code prints out "Foo::bar". This is even the case if I
define another 'sub bar' in foo.p6, the version from Foo.pm is still called.

Am I missunderstanding this, or is it a bug?

-garrett

Stevan Little

May 1, 2005, 10:11:43 PM5/1/05
to Garrett Rooney, perl6-c...@perl.org
Garrett,

On May 1, 2005, at 5:44 PM, Garrett Rooney wrote:
> I might have this wrong, but isn't the 'is export' trait on a
> subroutine supposed to indicate that it's exported into the namespace
> of the code that uses or requires the module? That doesn't seem to be
> happening right now. Well, it is happening, but it's also happening
> for subroutines without that trait, and that seems wrong.
>

> I'd assume this should be an error, since bar isn't exported, but it's
> not, running the code prints out "Foo::bar". This is even the case if
> I define another 'sub bar' in foo.p6, the version from Foo.pm is still
> called.
>
> Am I missunderstanding this, or is it a bug?

Currently 'is export' is a placeholder (which means it parses ok, but
does nothing). Packages/Modules are still unfinished in Pugs.

Stevan