Commit
Fixes wrong description of literals, and also adds some examples illustrating operators. Closes #2421
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,13 @@ or a L<Whatever>-star C<*>. The latter is used to indicate that any version | |
| part is acceptable in another version that is compared to the current one. | ||
| say v1.0.1 ~~ v1.*; # OUTPUT: «True» | ||
| say v1.0.1 ~~ v1.*.1; # OUTPUT: «True» | ||
| Version literals can only contain numeric and L<Whatever> parts. They start | ||
| with a lower-case C<v>, and are followed by at least one part. Multiple parts | ||
| are separate with a dot C<.>. A trailing C<+> indicates that higher versions | ||
| are OK in comparisons: | ||
| Version literals can then contain, in its first part, C<v> and a number, and can | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
JJ
Author
Contributor
|
||
| be followed by alphanumeric and L<Whatever> parts, and can have a C<+> as a | ||
| suffix. They start with a lower-case C<v>, and are followed by at least one | ||
| part. Multiple parts are separate with a dot C<.>. A trailing C<+> indicates | ||
| that higher versions are OK in comparisons: | ||
| say v1.2 ~~ v1.0; # OUTPUT: «False» | ||
| say v1.2 ~~ v1.0+; # OUTPUT: «True» | ||
|
|
@@ -30,7 +32,20 @@ In comparisons, early parts take precedence over later parts. | |
| say v1.2 cmp v2.1; # OUTPUT: «Less» | ||
| Please note that method calls, including pseudo methods like C<WHAT> require | ||
| The C<+> suffix is always taken into account in comparisons: | ||
| say v1.0.1+ <=> v1.0.1; # OUTPUT: «More» | ||
| And C<*> (C<Whatever>) is too, and considered always C<Less> than whatever digit | ||
This comment has been minimized.
Sorry, something went wrong.
ugexe
Contributor
|
||
| is in the corresponding part: | ||
| say v1.* <=> v1.0; # OUTPUT: «Less» | ||
| say v1.* <= v1.0; # OUTPUT: «True» | ||
| say v1.*+ <= v1.0; # OUTPUT: «True» | ||
| That happens even if the literal includes the C<+> suffix. | ||
This comment has been minimized.
Sorry, something went wrong.
ugexe
Contributor
|
||
| Please note that method calls, including pseudo methods like C<WHAT>, require | ||
| version literals to be enclosed with parentheses. | ||
| =head1 Methods | ||
|
|
@@ -39,7 +54,7 @@ version literals to be enclosed with parentheses. | |
| method new(Str:D $s) | ||
| Creates a Version from a string C<$s>. The string is combed | ||
| Creates a C<Version> from a string C<$s>. The string is combed | ||
| for the numeric, alphabetic, and wildcard components of the version object. | ||
| Any characters other than alphanumerics and asterisks are assumed | ||
| to be equivalent to a dot. A dot is also assumed between any adjacent | ||
|
|
@@ -49,13 +64,16 @@ numeric and alphabetic characters. | |
| method parts(Version:D: --> List:D) | ||
| Returns the list of parts that make up this Version object | ||
| Returns the list of parts that make up this C<Version> object | ||
| my $v1 = v1.0.1; | ||
| my $v2 = v1.0.1+; | ||
| say $v1.parts; # OUTPUT: «(1 0 1)» | ||
| say $v2.parts; # OUTPUT: «(1 0 1)» | ||
| The C<+> suffix is not a part of the object, but is taken into account in | ||
This comment has been minimized.
Sorry, something went wrong.
ugexe
Contributor
|
||
| comparisons. | ||
| =head2 method plus | ||
| method plus(Version:D: --> Bool:D) | ||
|
|
||
The previous description made more sense. There are grammatical errors now ( "can then contain," ? ), and the information that was added is redundant ( "in its first part, C and a number," -- "They start with a lower-case C, and are followed by at least one part" ).