Hi Lloyd!

> Seems to be it bugs out if you put "is export" on a
constant decl where the RHS is a &sub.

Exactly.

Meanwhile I just do something like this:

sub foo-alias is export { foo }

This works for me two. I will be waiting till bug is fixed so to rely
on better Perl6 syntax. SO, no hurry. Thanks

2017-01-10 14:35 GMT+03:00 Lloyd Fournier via RT <perl6-bugs-follo...@perl.org>:
> Looks like a bug to me. Seems to be it bugs out if you put "is export" on a
> constant decl where the RHS is a &sub.
>
> You could do this until it's fixed:
>
> sub foo is export { }
> BEGIN EXPORT::DEFAULT::{'&foo-alias'} = &foo;
>
> On Tue, Jan 10, 2017 at 1:21 AM Alexey Melezhik <
> perl6-bugs-follo...@perl.org> wrote:
>
> # New Ticket Created by  Alexey Melezhik
> # Please include the string:  [perl #130533]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=130533 >
>
>
> HI!
>
> Probably I  I miss the syntax, but I am trying to make an alias for
> exported module function and have this alias exported either.
>
> $ cat lib/Foo.pm6
> use v6;
>
> unit module Foo;
>
> sub foo is export { say "hi there" }
>
>
> $ perl6 -Ilib  -e 'use Foo; foo()'
> hi there
>
>
> ///
>
> $ cat lib/Foo.pm6
> use v6;
>
> unit module Foo;
>
> sub foo is export { say "hi there" }
>
> constant &foo-alias = &foo;
>
> perl6 -Ilib  -e 'use Foo; Foo::foo-alias()'
> hi there
>
> ///
>
> But last one does not compile:
>
> use v6;
>
> unit module Foo;
>
> sub foo is export { say "hi there" }
>
> constant &foo-alias is export = &foo;
>
>
> $ perl6  -c lib/Foo.pm6
> ===SORRY!=== Error while compiling /home/melezhik/projects/tmp/lib/Foo.pm6
> Can't use unknown trait 'is export' in a sub declaration.
> at /home/melezhik/projects/tmp/lib/Foo.pm6:7
>     expecting any of:
>         rw raw hidden-from-backtrace hidden-from-USAGE
>         pure default DEPRECATED inlinable nodal
>         prec equiv tighter looser assoc leading_docs trailing_docs
>
>
> Regards.
>
> Alexey
>

Reply via email to