On Sun, Aug 16, 2020 at 9:03 AM Ralph Mellor <ralphdjmel...@gmail.com> wrote:

> The SO you quote includes an operator. So that's not the problem.
>
> The SO is written by jnthn. It doesn't get more authoritative than that.

That's good to know, although for me the difference between it working
and not working (with that error) was the presence of an exported
infix operator. I can see that may be different with different
versions of Rakudo and different platforms etc.

> [...]
> Your export code is attempting to export `%?LANG`, but that already
> exists in every lexical scope. (`%?LANG`:is the language braid -- the
> dictionary of sub-languages that collectively constitute the Raku language.)
>
> So don't do that.
>
> In the SO jnthn demonstrates stripping out `$_`. You need to also strip
> out any other lexicals that you don't mean to export. So use a `say` to
> see what lexicals you're currently exporting and then grep out any that
> you don't mean to export.
>
> Perhaps share your code if you can't get it to work.

I also found I couldn't use the technique transitively (i.e.
sub-preludes) so using the approach you describe here I ended up with:

sub EXPORT() {{

  use Project::SubPrelude1;
  use Project::SubPrelude2;
  # etc

  ::.pairs.grep(*.key ∉ ('$_', '%?LANG', '$*DISPATCHER')).Map;
}}

Thanks for the feedback.

Stu

Reply via email to