Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rephrasing to clarify and fix grammar issues.
Also addresses last comment about enclosing them with parentheses,
which wasn't addressed before.
This closes #2421 again. Feel free to reopen if some further changes
need to be made.
  • Loading branch information
JJ committed Nov 2, 2018
1 parent e6483c2 commit 4652d2f
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions doc/Type/Version.pod6
Expand Up @@ -19,16 +19,16 @@ 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 then contain, in its first part, C<v> and a number, and can
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:
The first part of version literals contains C<v> and a number; this might be
followed by alphanumeric and L<Whatever> parts and trailed by C<+>. 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␤»
say v1.2 ~~ v1.0; # OUTPUT: «False␤»
say v1.2 ~~ v1.0+; # OUTPUT: «True␤»
say v0.and.anything.else ~~ v0+;# OUTPUT: «True␤»
In comparisons, early parts take precedence over later parts.
In comparisons, order matters, and every part is compared in turn.
say v1.2 cmp v2.1; # OUTPUT: «Less␤»
Expand All @@ -37,16 +37,19 @@ 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
is in the corresponding part:
is in the corresponding part, even if C<*> is trailed by C<+>:
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.
Please note that method calls, including pseudo methods like C<WHAT>, require
version literals to be enclosed with parentheses.
version literals either to be enclosed with parentheses or use some other method
to separate them from the dot that denotes a method call, like in these
examples:
say (v0.and.some.*.stuff).parts ;# OUTPUT: «(0 and some * stuff)␤»
say v0.and.some.*.stuff .parts ;# OUTPUT: «(0 and some * stuff)␤»
=head1 Methods
Expand All @@ -71,8 +74,8 @@ Returns the list of parts that make up this C<Version> object
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
comparisons.
The C<+> suffix is not considered a I<part> of the C<Version> object, and thus
not returned by this method, as shown above in the C<$v2> variable.
=head2 method plus
Expand Down

0 comments on commit 4652d2f

Please sign in to comment.