Skip to content

Commit 233cfa5

Browse files
committed
[v6.d REVIEW] Document :count on lines as deprecated
1 parent 40416b3 commit 233cfa5

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

doc/Type/Str.pod6

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ is returned by using features which explicitly set the top-level capture.
525525
526526
Defined as:
527527
528-
multi method lines(Str:D: :$count!)
529528
multi method lines(Str:D: $limit)
530529
multi method lines(Str:D:)
531530
@@ -539,21 +538,20 @@ Examples:
539538
say "a\nb".lines.elems; # OUTPUT: «2␤»
540539
say "a\n".lines.elems; # OUTPUT: «1␤»
541540
542-
The first multi in the definition above just counts the number of lines if
543-
C<count> is true.
541+
You can limit the
542+
number of lines returned by setting the C<$limit> variable to a non-zero,
543+
non-C<Infinity> value:
544544
545-
say <not there yet>.join("\n").lines( :count ); # OUTPUT: «3␤»
545+
say <not there yet>.join("\n").lines( 2 ); # OUTPUT: «(not there)␤»
546546
547-
However, this feature might be deprecated in the near future; you can always
548-
use:
547+
B«DEPRECATED as of C<6.d> language», the C<:count> argument can be used
548+
to return the total number of lines:
549549
550-
say <not there yet>.join("\n").lines.elems; # OUTPUT: «3␤»
550+
say <not there yet>.join("\n").lines( :count ); # OUTPUT: «3␤»
551551
552-
You can also limit the
553-
number of lines returned by setting the C<$limit> variable to a non-zero,
554-
non-C<Infinity> value:
552+
Use L<elems> call on the returned L<Seq> instead:
555553
556-
say <not there yet>.join("\n").lines( 2 ); # OUTPUT: «(not there)␤»
554+
say <not there yet>.join("\n").lines.elems; # OUTPUT: «3␤»
557555
558556
=head2 routine words
559557

0 commit comments

Comments
 (0)