On 9/30/18 3:00 AM, JJ Merelo wrote:
Hi
El dom., 30 sept. 2018 a las 11:18, ToddAndMargo (<toddandma...@zoho.com
<mailto:toddandma...@zoho.com>>) escribió:
On 9/30/18 1:21 AM, JJ Merelo wrote:
>
>
> El dom., 30 sept. 2018 a las 10:15, Laurent Rosenfeld via
perl6-users
> (<perl6-us...@perl.org <mailto:perl6-us...@perl.org>
<mailto:perl6-us...@perl.org <mailto:perl6-us...@perl.org>>>) escribió:
>
> the words method is extracting items from an input string. The
> $limit parameter tells the words method to extract not more than
> $limit items from the string. Setting the default to Inf only
tells
> the method to extract as many items as it can from the input
(i.e.
> to process the whole string), without any limit. But since
the input
> string cannot be infinite, the number of items will also not be
> infinite. So, the Inf default for $limit just states that
there is
> no limit, but you'll never get an infinity of items from a
> non-infinite string.
>
>
> There's no Inf default now in the definition (after latest code
> changes), and it's been changed in the documentation accordingly.
It's
> left in the examples, however (since that "default" is in the
code too,
> and is tested in roast), but that can be eliminated if it leads to
> confusion.
>
> Cheers
>
> JJ
Hi JJ,
I am confused. I thought that
$limit = Inf
used in
multi method words(Str:D $input: $limit = Inf --> Seq)
meant that the default was "Inf"
It's not now: https://docs.perl6.org/routine/words#class_Str
Also, it is not stated that $limit is optional. I would
propose adding a "?" to the end of $limit:
multi method words(Str:D $input : $limit? = Inf --> Seq)
That's not how it's defined. There are two forms in the method, which
effectively could be resumed to a single one
method words(Str:D: $limit?)
But that's simply not how it's defined in the source. The fact that
there are two multis indicate quite clearly that $limit is optional, but
if that's not enough, the examples should clarify that.
Cheers
--
JJ
Would it not be much more readable to only have one line?
I personally get lost if there are more than two lines.