Skip to content

Commit 0380487

Browse files
committed
more set/bag list clarifications
We're not trying to override explicit @ or .keys here, merely the implicit policy for a default of item in list context. Also, set/bag constructors are simply slurpies, and shouldn't care at all what was passed as the objects in those slurpies. Generally one should be using "union" to combine sets or bags anyway, not relying on implicit constructor semantics to do that.
1 parent 221b79f commit 0380487

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

S32-setting-library/Containers.pod

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,11 +1113,14 @@ See C<KeySet> for a container that can represent different sets as
11131113
keys are added or deleted.
11141114

11151115
Regardless of their behavior as hashes, set (and bag) types do not
1116-
flatten in list context; they are returned as items in list context.
1117-
On the other end, the constructors for set and bag types do not
1118-
automatically interpolate the contents of sets or bags (or any other
1119-
other item type). Together these rules allow us to constructs sets
1120-
and bags containing sets and bags as elements.
1116+
flatten in list context; in the absence of explicit interpolation
1117+
instructions (such as use of the C<@> sigil or C<.keys> method)
1118+
they are returned as items in list context. On the other end, the
1119+
constructors for set and bag types do not automatically interpolate
1120+
the contents of sets or bags (or any other other item type). They
1121+
simply take the list of objects slurped in and turn them into a set.
1122+
Together these rules allow us to constructs sets and bags containing
1123+
sets and bags as elements.
11211124

11221125
=over
11231126

0 commit comments

Comments
 (0)