Skip to content

Commit

Permalink
Adds note on how to access symbols from "required" modules.
Browse files Browse the repository at this point in the history
And I hope this closes Raku#1287, if I got it correctly.
  • Loading branch information
JJ authored and Kaiepi committed May 21, 2018
1 parent 0a2a1af commit 7fc6d4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion doc/Language/modules.pod6
Expand Up @@ -112,7 +112,13 @@ indirect lookup.
The symbols provided by the loaded module will not be imported into the current
scope. You may use L<dynamic lookup|/language/packages#index-entry-::()> or
L<dynamic subsets|/language/typesystem#subset> to use them by providing the
fully qualified name of a symbol.
fully qualified name of a symbol, for instance:
require ::("Test");
my &mmk = ::("Test::EXPORT::DEFAULT::&ok");
mmk('oi‽'); # OUTPUT: «ok 1 - ␤»
The FQN of C<ok> is C<Test::EXPORT::DEFAULT::&ok>. We are aliasing it to C<mmk> so that we can use that symbol provided by C<Test> in the current scope.
To import symbols you must define them at compile time. B<NOTE:> C<require>
is lexically scoped:
Expand Down
2 changes: 2 additions & 0 deletions xt/words.pws
Expand Up @@ -1373,3 +1373,5 @@ yyyy
zef
zoffixznet
zwj
mmk
FQN

0 comments on commit 7fc6d4b

Please sign in to comment.