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

Re: Re-export symbols

Thread Previous
From:
Fernando Santagata
Date:
January 10, 2017 11:33
Subject:
Re: Re-export symbols
Message ID:
CAJ+jyGjxq9WTt+H7=2fN7h7xzNcH6A--rVF_ZFkfZzS71QadWg@mail.gmail.com
Thank you that's very interesting.

I solved the problem I had, refactoring the modules I was working on: after
all I didn't have to ask anyone. Still the problem would bug me.

Thanks again!

On Tue, Jan 10, 2017 at 12:25 PM, Lloyd Fournier <lloyd.fourn@gmail.com>
wrote:

> 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
>>
>


-- 
Fernando Santagata

Thread Previous


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