Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Point out sub EXPORT must be before unit
  • Loading branch information
zoffixznet committed May 23, 2018
1 parent 9e948d0 commit 792e1fa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/Language/modules.pod6
Expand Up @@ -410,6 +410,18 @@ Then use the tag you like and pick the symbol by its name.
# OUTPUT: «(&uri-escape &uri-unescape &uri_escape &uri_unescape)␤»
my &escape-uri = URI::Escape::EXPORT::DEFAULT::<&uri_escape>;
Be careful I<not> to put C<sub EXPORT> after L«C<unit> declarator|/syntax/unit».
If you do so, it'll become just a sub inside your package, rather than the special
export sub:
unit module Bar;
sub EXPORT { %(Foo => &say) } # WRONG!!! Sub is scoped wrong
# ---------
sub EXPORT { %(Foo => &say) } # RIGHT!!! Sub is outside the module
unit module Bar;
=head2 Finding Modules
It is up to the module installer to know where C<compunit> expects modules to
Expand Down

0 comments on commit 792e1fa

Please sign in to comment.