Skip to content

Commit 994d37d

Browse files
committed
Mostly get rid of Parcel
1 parent d56204f commit 994d37d

File tree

13 files changed

+50
-89
lines changed

13 files changed

+50
-89
lines changed

lib/Language/5to6-perlop.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ specifically documented.
199199
=head2 Comma Operator
200200
201201
The comma operator works mostly as expected, but technically it creates
202-
Parcels (see L<http://doc.perl6.org/type/Parcel>) or separates arguments
202+
L<Lists|/type/List>) or separates arguments
203203
in function calls. Also, there is a C<:> variant that turns function
204204
calls into method calls - see
205205
L<http://doc.perl6.org/language/operators#infix_%3A>.

lib/Language/containers.pod

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,39 +113,40 @@ signature parameter marked as C<is rw>.
113113
=head2 Scalar containers and listy things
114114
115115
There are a number of positional container types with slightly different
116-
semantics in Perl 6. The most basic one is I<Parcel>, short for
117-
I<Parenthesis cell>. It is created by the comma operator and often delimited
118-
by round parentheses -- hence the name.
116+
semantics in Perl 6. The most basic one is L<List|/type/List>
117+
It is created by the comma operator.
119118
120-
say (1, 2, 3).WHAT; # (Parcel)
119+
say (1, 2, 3).WHAT; # (List)
121120
122-
A parcel is immutable, which means you cannot change the number of elements
123-
in a parcel. But if one of the elements happens to be a scalar container,
121+
A list is immutable, which means you cannot change the number of elements
122+
in a list. But if one of the elements happens to be a scalar container,
124123
you can still assign to it:
125124
126125
my $x = 42;
127126
($x, 1, 2)[0] = 23;
128127
say $x; # 23
129128
($x, 1, 2)[1] = 23; # Error: Cannot modify an immutable value
130129
131-
So the parcel doesn't care about whether its elements are values or
130+
So the list doesn't care about whether its elements are values or
132131
containers, they just store and retrieve whatever was given to them.
133132
134-
A C<List> has the same attitude of indifference towards containers. But it
135-
allows modifying the length (for example with C<push>, C<pop>, C<shift> and
136-
C<unshift>), and it is also lazy.
133+
Lists can also be lazy, so elements at the end are generated on demand from an
134+
iterator.
137135
138136
An C<Array> is just like a list, except that it forces all its elements to
139-
be containers. Thus you can say
137+
be containers, which means that you can always assign to elements:
140138
141139
my @a = 1, 2, 3;
142140
@a[0] = 42;
143141
say @a; # 42 2 3
144142
145-
and C<@a> actually stores three scalar containers. C<@a[0]> returns one of
143+
C<@a> actually stores three scalar containers. C<@a[0]> returns one of
146144
them, and the assignment operator replaces the integer value stored in that
147145
container with the new one, C<42>.
148146
147+
An L<Array> also has methods that can change the number of elements, notably
148+
C<push>, C<pop>, C<shift>, C<unshift> and C<splice>.
149+
149150
=head2 Assigning and binding to array variables
150151
151152
Assigning to a scalar variable and to an array variable both do basically
@@ -162,7 +163,7 @@ makes no such effort.
162163
To place a non-C<Array> into an array variable, binding works:
163164
164165
my @a := (1, 2, 3);
165-
say @a.WHAT; # (Parcel)
166+
say @a.WHAT; # (List)
166167
167168
=head2 Binding to array elements
168169
@@ -241,7 +242,7 @@ container:
241242
@b = @($item), 4, 5; # a shortcut
242243
@b = @$item, 4, 5; # another shortcut
243244
244-
Other methods on lists also return flat lists/parcels, so for example
245+
Other methods on lists also return flat lists, so for example
245246
246247
my $item = [1, 2, 3];
247248
my @b = $item.sort, 4, 5; # 5 elems
@@ -327,7 +328,7 @@ And a few that don't flatten:
327328
=item .tree
328329
329330
The first two cannot flatten, otherwise it would be very hard to get access
330-
to the structure that's actually stored in the list or parcel and the whole
331+
to the structure that's actually stored in the list and the whole
331332
point of C<.tree> is not to flatten.
332333
333334
=end pod

lib/Language/objects.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ order|https://en.wikipedia.org/wiki/C3_linearization>. You can ask a type
319319
for its MRO through a call to its meta class:
320320
321321
=for code :allow<B L>
322-
say ParcelB<.^L<mro>>; # Parcel() Cool() Any() Mu()
322+
say List<.^L<mro>>; # List() Cool() Any() Mu()
323323
324324
If a class does not specify a parent class, L<Any> is assumed by default.
325325
All classes directly or indirectly derive from L<Mu>, the root of the type

lib/Language/operators.pod

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,17 @@ L</language/functions#Defining_Operators>.
112112
=head2 circumfix C«< >»
113113
114114
The quote-words construct. Breaks up the contents on whitespace, and returns
115-
a C<Parcel> of the words. If a word
115+
a L<List|/type/List> of the words. If a word
116116
looks like a number literal or a C<Pair> literal, it is converted to the
117117
appropriate number.
118118
119119
say <a b c>[1]; # b
120120
121-
(Rakudo currently always returns a parcel of strings).
122-
123121
=head2 circumfix C«( )»
124122
125123
The grouping operator.
126124
127-
An empty group C<()> creates an empty L<Parcel>.
125+
An empty group C<()> creates an empty L<List>.
128126
Parens around non-empty expressions simply structure the expression, but
129127
not have additional semantics.
130128
@@ -271,15 +269,15 @@ Technically this is not an operator, but syntax special-cased in the compiler.
271269
=head2 postfix C«.+»
272270
273271
C<$invocant.+method> calls all methods called C<method> from C<$invocant>,
274-
and returns a L<Parcel> of the results. Dies if no such method was found.
272+
and returns a L<List> of the results. Dies if no such method was found.
275273
276274
Technically this is not an operator, but syntax special-cased in the compiler.
277275
278276
=head2 postfix C«.*»
279277
280278
C<$invocant.*method> calls all methods called C<method> from C<$invocant>,
281-
and returns a L<Parcel> of the results. If no such method was found, an empty
282-
L<Parcel> is returned.
279+
and returns a L<List> of the results. If no such method was found, an empty
280+
L<List> is returned.
283281
284282
Technically this is not an operator, but syntax special-cased in the compiler.
285283
@@ -470,12 +468,11 @@ Coerces the argument to L<Str> by calling the C<Str> method on it.
470468
471469
=head2 prefix C«|»
472470
473-
Flattens objects of type L<Capture>, L<Enum>, L<Pair>, L<List>, L<Parcel>,
471+
Flattens objects of type L<Capture>, L<Enum>, L<Pair>, L<List>
474472
L<EnumMap> and L<Hash> into an argument list.
475473
476-
(In Rakudo, this is implemented not as a proper operator but as a special
477-
case in the compiler, which means it only works in argument lists, not in
478-
arbitrary code).
474+
Outside of argument lists, it returns a L<Slip|/type/Slip>, which makes it
475+
flatten into the outer list.
479476
480477
=head2 prefix C«+^»
481478
@@ -1343,9 +1340,9 @@ and returns the result.
13431340
13441341
=head2 infix C«,»
13451342
1346-
sub infix:<,>(*@a) is assoc<list> returns Parcel:D
1343+
sub infix:<,>(*@a) is assoc<list> returns List:D
13471344
1348-
Constructs a L<Parcel> from its arguments. Also used syntactically as the
1345+
Constructs a L<List> from its arguments. Also used syntactically as the
13491346
separator of arguments in calls.
13501347
13511348
=head2 infix C«:»
@@ -1373,7 +1370,7 @@ the first input list is exhausted:
13731370
say (1, 2 Z <a b c> Z <+ ->).perl; # ((1, "a", "+"), (2, "b", "-")).list
13741371
13751372
The C<Z> operator also exists as a meta operator, in which case the inner
1376-
parcels are replaced by the value from applying the meta'ed operator to the
1373+
lists are replaced by the value from applying the meta'ed operator to the
13771374
list:
13781375
13791376
say 100, 200 Z+ 42, 23; # 142, 223
@@ -1392,7 +1389,7 @@ elements vary most rapidly
13921389
(3, 'a', 9), (3, 'b', 9), (3, 'c', 9)
13931390
13941391
The C<X> operator also exists as a meta operator, in which case the inner
1395-
parcels are replaced by the value from applying the meta'ed operator to the
1392+
lists are replaced by the value from applying the meta'ed operator to the
13961393
list:
13971394
13981395
1..3 X~ <a b c> X~ 9

lib/Language/setbagmix.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ equivalent ASCII version (like L<C<(elem)>|(elem)> or L<C<(|)>|(|)>).
8484
Most of the time, explicitly using C<Set> objects with these infixes is
8585
unnecessary. All of the infix operators will work on any objects of type
8686
L<C<Any>|Any> for its arguments (e.g., L<C<List>s|List>,
87-
L<C<Parcel>s|Parcel>, L<C<Mix>es|Mix>, etc.) and coerce them to C<Set>s
87+
L<C<Array>s|Array>, L<C<Mix>es|Mix>, etc.) and coerce them to C<Set>s
8888
where needed.
8989
9090
In some cases, if the type of an argument is a L<Bag>, the infix operator

lib/Language/subscripts.pod

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,7 @@ So even a one-element list returns a slice, whereas a bare scalar value doesn't:
218218
219219
(The angle-bracket form for associative subscripts works out because
220220
L<word quoting|/language/quoting#Word_quoting:_qw> conveniently returns a
221-
L<Str> in case of a single word, but a L<Parcel> in case of multiple words.)
222-
223-
=comment TODO: Revisit the above paragraph after the GLR, when it will probably
224-
be a List instead of a Parcel.
221+
L<Str> in case of a single word, but a L<List> in case of multiple words.)
225222
226223
For a normal slice, the content of (L<the current dimension of|#Multiple
227224
dimensions>) the subscript is I<flattened> before its members are interpreted
@@ -263,12 +260,9 @@ returns the subscripted object itself. Since it is empty but returns
263260
everything, it is known as a "Zen slice".
264261
265262
It is different both from passing a Whatever-star (which, like a normal slice,
266-
always returns a Parcel of elements no matter the type of the original object)
263+
always returns a List of elements no matter the type of the original object)
267264
and from passing an empty list (which returns an empty slice):
268265
269-
=comment TODO: Revisit the above paragraph after the GLR, when it will probably
270-
be a List instead of a Parcel.
271-
272266
my %bag := ("orange" => 1, "apple" => 3).Bag;
273267
dd %bag<>; #-> ("orange"=>1,"apple"=>3).Bag
274268
dd %bag{}; #-> ("orange"=>1,"apple"=>3).Bag

lib/Language/terms.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ the C<:!identifier> form is C<Bool::False>.
9090
If used in an argument list, all of these forms count as named arguments,
9191
with the exception of C<< 'quoted string' => $value >>.
9292
93-
=head2 Parcel
93+
=head2 List
9494
9595
()
9696
1, 2, 3
9797
<a b c>
9898
«a b c»
9999
qw/a b c/
100100
101-
L<Parcel> literals are: the empty pair of parens C<()>, a comma-separated
101+
L<List> literals are: the empty pair of parens C<()>, a comma-separated
102102
list, or several quoting constructs.
103103
104104
=head2 term *

lib/Language/variables.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ seen in the current expression or declarator:
6363
say @bar.perl; # [7, 9]<>
6464
6565
(my $baz) = 11, 13; # list assignment
66-
say $baz.WHAT; # Parcel
66+
say $baz.WHAT; # (List)
6767
say $baz.perl; # (11, 13)
6868
6969
Thus, the behavior of an assignment contained within a list assignment depends
@@ -90,7 +90,7 @@ expression determines the type of assignment:
9090
my ( @foo, $bar );
9191
@foo = ($bar) = 42, "str"; # list assignment: uses parens
9292
say @foo.perl; # [42, "str"]<> (an Array)
93-
say $bar.perl; # $(42, "str") (a Parcel)
93+
say $bar.perl; # $(42, "str") (a List)
9494
9595
However, if the internal assignment is neither a declarator nor an
9696
expression, but is part of a larger expression, the context of the

lib/Type/Cool.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following built-in types inherit from C<Cool>:
2121
L<Array> L<Backtrace> L<Bag> L<Baggy> L<Bool> L<Complex> L<Cool>
2222
L<Duration> L<Enumeration> L<EnumMap> L<FatRat> L<Hash> L<Instant>
2323
L<Int> L<KeyHash> L<KeySet> L<List>
24-
L<Nil> L<Num> L<Numeric> L<Parcel>
24+
L<Nil> L<Num> L<Numeric>
2525
L<Range> L<Real> L<Seq> L<Set> L<Stash> L<Str> L<Stringy>
2626
2727
The following table summarizes the methods that C<Cool> provides, and

lib/Type/List.pod

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Arrays to have every value of the list stored in a container.
1717
1818
In Perl 6, assigning a C<List> to a scalar variable does not lose
1919
information. The difference is that iteration generally treats a
20-
list (or any other list-like object, like a C<Parcel> or an C<Array>)
20+
list (or any other list-like object, like a L<Seq> or an L<Array>)
2121
inside a scalar as a single element.
2222
2323
my @a = 1, 2, 3;
@@ -130,7 +130,7 @@ C<map> inspects the arity of the code object, and tries to pass as many argument
130130
131131
iterates the list two items at a time.
132132
133-
Note that C<map> does not flatten embedded lists and parcels, so
133+
Note that C<map> does not flatten embedded lists and array, so
134134
135135
((1, 2), <a b>).map({ .join(',')})
136136
@@ -143,7 +143,7 @@ passes C<(1, 2)> and C<< <a b> >> in turn to the block, leading to a total of tw
143143
Like C<map> iterates over the elements of the invocant list, feeding each
144144
element in turn to the code reference, and assembling the return values from these invocations in a result list.
145145
146-
Unlike C<map> it flattens non-itemized lists and parcels, so
146+
Unlike C<map> it flattens non-itemized lists and arrays, so
147147
148148
say ((1, 2), <a b>).flatmap(&uc).join('|'); # 1|2|A|B
149149
@@ -559,17 +559,19 @@ assigning it:
559559
560560
=head2 routine zip
561561
562-
sub zip(List:D:, List:D:, ...) returns List:D
562+
sub zip(List:D:, List:D:, ...) returns Seq:D
563563
564564
Zip two or more lists together by interleaving their elements. If the lists
565565
have different lengths, then the lists are zipped to the length of the
566566
shortest list; elements of the longer list(s) are discarded.
567567
568568
In order to support parallel iteration over multiple arrays, Perl 6
569-
has a C<zip> function that builds a list of C<Parcel> objects from the
569+
has a C<zip> function that builds a list of C<List> objects from the
570570
elements of two or more arrays. In ordinary list context this behaves
571571
as a list of C<Captures> and automatically flattens.
572572
573+
=comment TODO: GLR
574+
573575
for zip(@names; @codes) -> $name, $zip {
574576
say "Name: $name; Zip code: $zip";
575577
}
@@ -596,7 +598,7 @@ skip missing entries, use L<roundrobin|/type/List#sub_roundrobin> instead:
596598
597599
=head2 sub roundrobin
598600
599-
multi roundrobin(List:D: --> Parcel)
601+
multi roundrobin(List:D: --> Seq)
600602
601603
C<roundrobin> is very similar to L<zip|/type/List#routine_zip>. The
602604
difference is that C<roundrobin> will not stop on lists that run out of

0 commit comments

Comments
 (0)