Skip to content

Commit f84f624

Browse files
committed
Clarify a sentence in #2469
Clarify a sentence and make the code example align (?) with it. Also, text reflow.
1 parent c8b17a8 commit f84f624

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

doc/Language/objects.pod6

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ my @words = "Abe", "Lincoln";
5050
say @words;
5151
# OUTPUT: «[Abe Lincoln said (Fourscore and seven years ago)]␤»
5252
53-
Multiple arguments can be specified by separating the argument list with
54-
a colon:
53+
Similarly, multiple arguments can be specified by placing a colon after
54+
the method and separating the argument list with a comma:
5555
5656
=for code :preamble<my @words;>
57-
say @words.join: '--';
58-
# OUTPUT: «Abe--Lincoln--said--Fourscore and seven years ago␤»
57+
say @words.join('--').subst: 'years', 'DAYS';
58+
# OUTPUT: «Abe--Lincoln--said--Fourscore and seven DAYS ago␤»
5959
6060
Since you have to put a C<:> after the method if you want to pass
6161
arguments without parentheses, a method call without a colon or
@@ -144,10 +144,12 @@ another class.
144144
=head2 Attributes
145145
X<|Attribute> X<|Property> X<|Member> X<|Slot>
146146
147-
Attributes are variables that exist per instance of a class; when instantiated to a value, the association between the variable and its value is called a property. They are where
148-
the state of an object is stored. In Perl 6, all attributes are I<private>,
149-
that means they can be accessed directly only by the class instance itself.
150-
They are typically declared using the C<has> declarator and the C<!> twigil.
147+
Attributes are variables that exist per instance of a class; when instantiated
148+
to a value, the association between the variable and its value is called a
149+
property. They are where the state of an object is stored. In Perl 6, all
150+
attributes are I<private>, that means they can be accessed directly only by
151+
the class instance itself. They are typically declared using the C<has>
152+
declarator and the C<!> twigil.
151153
152154
class Journey {
153155
has $!origin;
@@ -387,7 +389,7 @@ L<multi|/syntax/multi> declarator:
387389
=head2 self
388390
389391
Inside a method, the term C<self> is available, which is bound to the
390-
invocant. C<self> can be used to call further methods on the invocant,
392+
invocant. C<self> can be used to call further methods on the invocant,
391393
including constructors:
392394
393395
class Box {
@@ -532,7 +534,8 @@ Objects are generally created through method calls, either on the type
532534
object or on another object of the same type.
533535
534536
Class L<Mu> provides a constructor method called L<new>, which takes named
535-
L<arguments|/language/functions#Arguments> and uses them to initialize public attributes.
537+
L<arguments|/language/functions#Arguments> and uses them to initialize public
538+
attributes.
536539
537540
class Point {
538541
has $.x;
@@ -625,9 +628,9 @@ However this is considered poor practice, because it makes correct
625628
initialization of objects from subclasses harder.
626629
627630
Another thing to note is that the name C<new> is not special in Perl 6. It is
628-
merely a common convention, one that is followed quite thoroughly in L<most Perl 6
629-
classes|/routine/new>. You can call C<bless> from any method at all, or use
630-
C<CREATE> to fiddle around with low-level workings.
631+
merely a common convention, one that is followed quite thoroughly in
632+
L<most Perl 6 classes|/routine/new>. You can call C<bless> from any method at
633+
all, or use C<CREATE> to fiddle around with low-level workings.
631634
632635
The C<TWEAK> submethod allows you to check things or modify attributes after
633636
object construction:
@@ -845,10 +848,11 @@ So if you write:
845848
then C<X::Ouch> will inherit directly from Exception, as we can see above
846849
by listing its parents.
847850
848-
As they do not use what can properly be called inheritance, roles are not part of the class hierarchy.
849-
Roles are listed with the C<.^roles> meta-method instead, which uses C<transitive> as flag for including all levels or just the first one. Despite this, a
850-
class or instance may still be tested with smartmatches or type constraints
851-
to see if it does a role.
851+
As they do not use what can properly be called inheritance, roles are not part
852+
of the class hierarchy. Roles are listed with the C<.^roles> meta-method
853+
instead, which uses C<transitive> as flag for including all levels or just the
854+
first one. Despite this, a class or instance may still be tested with
855+
smartmatches or type constraints to see if it does a role.
852856
853857
=begin code
854858
role F { }

0 commit comments

Comments
 (0)