develooper Front page | perl.perl6.users | Postings from January 2017

Re: Re-export symbols

Thread Previous | Thread Next
From:
Lloyd Fournier
Date:
January 10, 2017 19:25
Subject:
Re: Re-export symbols
Message ID:
CAH5Bsr1jEifYWmSrU78m9tLQ31FB41gQi9Pfrcu8ZKbQAcMKFw@mail.gmail.com
Hey Fernando,

This is not yet implemented in rakudo. I included a way of doing this in
CompUnit::Util <https://github.com/LLFourn/p6-CompUnit-Util#re-export>. I'm
not sure when/if :EXPORT will be implemented (I actually don't think it's a
good idea).

I've just realised that there is another solution though. You can do this:

use FirstModule;
my package EXPORT::DEFAULT { } # initialise the export namespace
BEGIN for <&foo &bar &baz> { # iterate over the things you want to
re-export by default
        EXPORT::DEFAULT::{$_} = ::($_)
}

This actually might be worth adding to the docs.

LL



On Sat, Dec 31, 2016 at 8:43 AM Fernando Santagata <
nando.santagata@gmail.com> wrote:

> Hello,
>
> I have a module that defines some constants and another one that use the
> first module.
> I wish to re-export those constants.
>
> I read here:
>
> http://design.perl6.org/S11.html
>
> that this:
>
> use FirstModule :EXPORT;
>
> should re-export the imported symbols, but it throws an error (no such tag
> 'EXPORT').
>
> Any idea?
>
> --
> Fernando Santagata
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About