@@ -142,18 +142,95 @@ to definitively know if the sequence will be finite or infinite.
142
142
to indicate that such sequences are to be treated as known finite
143
143
or known infinite.)
144
144
145
- =head1 DISCUSSION
145
+ =head1 MAJOR CHANGES AND DISCUSSION
146
146
147
- During the draft phases of this document, feel free to add questions
148
- and/or discussion points here. Links to #perl6 logs are acceptable.
147
+ During the draft phases of this document, the major changes from pre-GLR
148
+ are listed here, along with any side-conjectures and discussion. Feel
149
+ free to add questions or comments below, including references to relevant
150
+ #perl6 irclogs as appropriate.
149
151
150
152
=over 4
151
153
152
154
=item *
153
155
156
+ The C<Parcel> type is going away (yay!). C<< infix:<,> >> will
157
+ directly produce C<List> objects. This changes the way that nested
158
+ parenthesized comma lists react to things like C<.elems>> and C<.[]>.
159
+
160
+ (1, (2, 3)).elems # (pre-GLR) 3; (post-GLR) 2
161
+ (1, 2, 3..7).elems # (pre-GLR) 7; (post-GLR) 3
162
+
163
+ =item *
164
+
165
+ The C<for> statement will no longer flatten the value provided to it.
166
+ In fact, C<for> will now be exactly isomorphic to C<.map>:
167
+
168
+ foo VALUES { ... }
169
+ VALUES.map( { ... } } # same thing
170
+
171
+ This even extends to the case where the thing being iterated is
172
+ an itemizing container holding an C<Iterable>:
173
+
174
+ my $s = <apple banana cherry date eggplant>;
175
+ for $s { .say } # five iterations
176
+ $s.map: { .say } # five iterations
177
+
178
+ The end result is fewer requirements for C<.list> or C<@()>
179
+ contextualizers on things being iterated that just happen to be
180
+ in scalar containers.
181
+
182
+ =item *
183
+
184
+ The C<< circumfix:<[ ]> >> array constructor and C<< circumfix:<{ }> >>
185
+ hash constructor are no longer itemized by default. Use C<$[ ]> and
186
+ C<${ }> to explicitly itemize.
187
+
188
+ This results in several desirable outcomes:
189
+
190
+ my @a = [ 1, 2, 3 ]; # @a has three elements
191
+ say @a.perl; # "[1, 2, 3]" (trailing "<>" not needed)
192
+
193
+ =item *
194
+
154
195
Pm thinks/remembers that people preferred C<Iterable> to be a role
155
196
instead of a class.
156
197
198
+ =item *
199
+
200
+ Looping constructs ( C<while>, C<for>, C<until>, C<loop> ) will be able
201
+ to lazily return lists, as described in C<S04>.
202
+
203
+ =item *
204
+
205
+ Because of the above, the GLR will need to improve sink context handling...
206
+ in particular by providing caller context. (Jonathan and Pm have already
207
+ had discussions about how this can be achieved.)
208
+
209
+ =item *
210
+
211
+ The C<gather/take> statement will become much more efficient.
212
+ In particular, it will evolve so that some or all C<take> statements
213
+ will be able to populate the list without requiring continuations
214
+ and exceptions at every step. As a result, it's very possible that
215
+ some or most of the underlying list-handling code will be based on
216
+ the gather/take system.
217
+
218
+ =item *
219
+
220
+ Some miscellaneous notes on list-based methods:
221
+
222
+ @list.flat # never returns self
223
+ @list.list # may return self
224
+ @list.kv # returns (0, @list[0], 1, @list[1], ...)
225
+ # not ( (0, @list[0]), (1, @list[1]), ...)
226
+
227
+ =item *
228
+
229
+ A new type is conjectured that immediately interpolates a list
230
+ of values into its surrounding list when it is encountered.
231
+ This new type would replace the pre-GLR meaning of C<Nil> and
232
+ the temporary C<Empty> type.
233
+
157
234
=back
158
235
159
236
=head1 AUTHORS
0 commit comments