Skip to content

Commit ab39e38

Browse files
committed
More clarifications, reindentations and reflow
1 parent 9787750 commit ab39e38

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

doc/Type/Capture.pod6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Defined as:
101101
Returns the number of positional elements in the Capture.
102102
103103
my Capture $c = \(2, 3, 5, apples => (red => 2));
104-
say $c.elems; # OUTPUT: «3␤»
104+
say $c.elems; # OUTPUT: «3␤»
105105
106106
=head2 method keys
107107
@@ -114,7 +114,7 @@ named keys. For positional arguments the keys are the respective arguments
114114
ordinal position starting from zero.
115115
116116
my $capture = \(2, 3, 5, apples => (red => 2));
117-
say $capture.keys; # OUTPUT: «(0 1 2 apples)␤»
117+
say $capture.keys; # OUTPUT: «(0 1 2 apples)␤»
118118
119119
=head2 method values
120120
@@ -126,7 +126,7 @@ Returns a L<Seq|/type/Seq> containing all positional values followed by all
126126
named argument values.
127127
128128
my $capture = \(2, 3, 5, apples => (red => 2));
129-
say $capture.values; # OUTPUT: «(2 3 5 red => 2)␤»
129+
say $capture.values; # OUTPUT: «(2 3 5 red => 2)␤»
130130
131131
=head2 method kv
132132
@@ -204,4 +204,4 @@ Returns the number of positional elements in the Capture.
204204
205205
=end pod
206206

207-
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
207+
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

doc/Type/Mu.pod6

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,11 @@ say $p.perl;
344344
# OUTPUT: «Point-with-ID.new(ID => "*1-2", x => 1, y => 2)␤»
345345
=end code
346346
347-
In this code, C<bless> called within C<Point.new> is eventually calling C<BUILD>
348-
with the same parameters. We have to create a convoluted way of using the
349-
C<$.ID> attribute using the meta-object protocol so that we can instantiate it
350-
and thus serve that C<new> constructor, which can be called on C<Point-with-ID>
351-
since it is a subclass.
347+
In this code, C<bless>, called within C<Point.new>, is eventually calling
348+
C<BUILD> with the same parameters. We have to create a convoluted way of using
349+
the C<$.ID> attribute using the meta-object protocol so that we can instantiate
350+
it and thus serve that C<new> constructor, which can be called on
351+
C<Point-with-ID> since it is a subclass.
352352
353353
We might have to use something similar if we want to instantiate superclasses.
354354
C<bless> will help us with that, since it is calling across all the hierarchy:
@@ -373,20 +373,20 @@ class Str-with-ID is Str {
373373
374374
say Str-with-ID.new("1.1,2e2").ID; # OUTPUT: «0␤»
375375
my $ided-str = Str-with-ID.new("3,4");
376-
say "$ided-str, {$ided-str.^name}, {$ided-str.ID}"; # OUTPUT: «3,4, Str-with-ID, 1␤»
376+
say "$ided-str, {$ided-str.^name}, {$ided-str.ID}";
377+
# OUTPUT: «3,4, Str-with-ID, 1␤»
377378
=end code
378379
379-
We are *enriching* C<Str> with an auto-incrementing ID. We create a C<new> since
380-
we want to initialize it with a string and, besides, we need to instantiate the
381-
superclass. We do so using C<bless> from within C<new>. C<bless> is going to
382-
call C<Str.BUILD>. It will *capture* the value it's
383-
looking for, the pair C<value => $str> and initialize itself. But we have to
384-
initialize also the properties of the subclass, which is why within C<BUILD> we
385-
use the previously explained method to initialize C<$.ID> with the value that is
386-
in the C<%args> variable. As shown in the output, the objects will be correctly
387-
initialized with its ID, and will correctly behave as C<Str>, converting
388-
themselves in just the string in the C<say> statement, and including the C<ID>
389-
property as required.
380+
We are I<enriching> C<Str> with an auto-incrementing ID. We create a C<new>
381+
since we want to initialize it with a string and, besides, we need to
382+
instantiate the superclass. We do so using C<bless> from within C<new>. C<bless>
383+
is going to call C<Str.BUILD>. It will *capture* the value it's looking for, the
384+
pair C<value => $str> and initialize itself. But we have to initialize also the
385+
properties of the subclass, which is why within C<BUILD> we use the previously
386+
explained method to initialize C<$.ID> with the value that is in the C<%args>
387+
variable. As shown in the output, the objects will be correctly initialized with
388+
its ID, and will correctly behave as C<Str>, converting themselves in just the
389+
string in the C<say> statement, and including the C<ID> property as required.
390390
391391
For more details see
392392
L<the documentation on object construction|/language/objects#Object_Construction>.
@@ -457,9 +457,9 @@ mechanism when no direct candidate is available to dispatch to.
457457
458458
multi method WHICH(--> ObjAt:D)
459459
460-
Returns an object of type L<ObjAt|/type/ObjAt> which uniquely identifies the object.
461-
Value types override this method which makes sure that two equivalent objects
462-
return the same return value from C<WHICH>.
460+
Returns an object of type L<ObjAt|/type/ObjAt> which uniquely identifies the
461+
object. Value types override this method which makes sure that two equivalent
462+
objects return the same return value from C<WHICH>.
463463
464464
say 42.WHICH eq 42.WHICH; # OUTPUT: «True␤»
465465

doc/Type/Whatever.pod6

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
=TITLE class Whatever
44
5-
=SUBTITLE Placeholder for an unspecified value/argument
5+
=SUBTITLE Placeholder for the value of an unspecified argument
66
77
class Whatever { }
88
@@ -77,7 +77,8 @@ C<WhateverCode>s.
7777
my $x = *;
7878
$x + 2; # Not a closure, dies because it can't coerce $x to Numeric
7979
CATCH { default { put .^name, ': ', .Str } };
80-
# OUTPUT: «X::Multi::NoMatch: Cannot resolve caller Numeric(Whatever: ); none of these signatures match:␤
80+
# OUTPUT: «X::Multi::NoMatch: Cannot resolve caller Numeric(Whatever: );
81+
# none of these signatures match:␤
8182
# (Mu:U \v: *%_)»
8283
8384
The use cases for stored C<Whatever>-stars involve those curry-exception

0 commit comments

Comments
 (0)