Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes Version documents
Fixes wrong description of literals, and also adds some examples
illustrating operators. Closes #2421
  • Loading branch information
JJ committed Nov 2, 2018
1 parent 74c6a6d commit 62d8495
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions doc/Type/Version.pod6
Expand Up @@ -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.

Copy link
@ugexe

ugexe Nov 2, 2018

Contributor

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" ).

This comment has been minimized.

Copy link
@JJ

JJ Nov 2, 2018

Author Contributor

It was changed because of this issue #2421
Grammatical errors should be fixed, of course.

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␤»
Expand All @@ -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.

Copy link
@ugexe

ugexe Nov 2, 2018

Contributor

Don't start a sentence with "and" and then compound it with more "and"s

This comment has been minimized.

Copy link
@JJ

JJ Nov 2, 2018

Author Contributor

OK

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.

Copy link
@ugexe

ugexe Nov 2, 2018

Contributor

What is "That"? If its referencing the previous sentence ( not code ) why is it not grouped there?

This comment has been minimized.

Copy link
@JJ

JJ Nov 2, 2018

Author Contributor

Will fix

Please note that method calls, including pseudo methods like C<WHAT>, require
version literals to be enclosed with parentheses.
=head1 Methods
Expand All @@ -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
Expand All @@ -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.

Copy link
@ugexe

ugexe Nov 2, 2018

Contributor

I don't understand this sentence. The '+' isn't a part of what parts returns, but its certainly part of the object.

This comment has been minimized.

Copy link
@JJ

JJ Nov 2, 2018

Author Contributor

Well, "parts" returns parts of the object. It does not return "+", thus it's not a part. It's an attribute of the object.

comparisons.
=head2 method plus
method plus(Version:D: --> Bool:D)
Expand Down

0 comments on commit 62d8495

Please sign in to comment.