Skip to content

Commit 8970224

Browse files
authored
add some more info on module import vs. export
1 parent 9eaf716 commit 8970224

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

doc/Language/modules.pod6

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ tags: C<ALL>, C<DEFAULT> and C<MANDATORY>.
159159
use MyModule :ALL; # bag, pants, sunglasses, torch, underpants
160160
=end code
161161
162+
Note there currently is no way for the user to import a single object if
163+
the module author hasn't made provision for that, and it is not an easy
164+
task at the moment (see RT #127305). One way the author can provide
165+
such access is to give each C<export> trait its own unique tag. Then
166+
the user can either (1) import all objects:
167+
168+
=begin code
169+
use Foo :ALL;
170+
=end code
171+
172+
or (2) import one or more objects selectively:
173+
174+
=begin code
175+
use Foo :s1, :s5;
176+
=end code
177+
162178
Notes:
163179
164180
1. The C<:MANDATORY> tag on an exported sub ensures it will be exported
@@ -176,6 +192,9 @@ no matter whether the using program adds any tag or not.
176192
use MyModule :day, :night; # pants, sunglasses, torch
177193
=end code
178194
195+
5. Multiple tags in the C<export> trait are not allowed.
196+
197+
179198
=head3 UNIT::EXPORT::*
180199
181200
Beneath the surface, C<is export> is adding the symbols to a C<UNIT>

0 commit comments

Comments
 (0)