Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Proofreading and light edits of docs
  • Loading branch information
Coleoid committed May 16, 2016
1 parent 331bdb9 commit 9c6a4a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
21 changes: 9 additions & 12 deletions doc/Language/classtut.pod
Expand Up @@ -271,14 +271,13 @@ example) will not repeat the task.
=head2 Private Methods
Analogous to attributes methods can be private. Private methods are declared
Analogous to attributes, methods can be private. Private methods are declared
with a prefixed exclamation mark. They are called with C<self!> followed by the
methods name. To call a private method of another class the calling class has
method's name. To call a private method of another class the calling class has
to be trusted by the called class. A trust relationship is declared with
C<trusts> and the to be trusted class has to be declared already. Calling a
private methods of another class requires an instance of that class and the
fully qualified name of the method. Trust also applies to accessor methods of
private attributes.
C<trusts> and the class to be trusted must already be declared. Calling a
private method of another class requires an instance of that class and the
fully qualified name of the method. Trust also allows access to private attributes.
class B {...}
Expand Down Expand Up @@ -312,7 +311,7 @@ X<|constructors>
Perl 6 is rather more liberal than many languages in the area of
constructors. A constructor is anything that returns an instance of the
class. Furthermore, constructors are ordinary methods. You inherit a
default constructor named C<new> from the base class C<Object>, but you are
default constructor named C<new> from the base class C<Mu>, but you are
free to override C<new>, as this example does:
method new(&callback, *@dependencies) {
Expand Down Expand Up @@ -512,10 +511,8 @@ As mentioned before, a class can inherit from multiple classes. When a
class inherits from multiple classes the dispatcher knows to look at both
classes when looking up a method to search for. Perl 6 uses the C3
algorithm to linearize multiple inheritance hierarchies, which is a
significant improvement over Perl 5's approach to handling multiple
inheritance.
=comment isn't Perl 5 also C3 now?
significant improvement over Perl 5's default approach
(depth-first search) to handling multiple inheritance.
=begin code
class GeekCook is Programmer is Cook {
Expand Down Expand Up @@ -592,7 +589,7 @@ called on C<$o>. The C<:local> named argument limits the returned methods to
those defined in the C<Employee> class and excludes the inherited methods.
The syntax of calling a method with C<.^> instead of a single dot means that
it is actually a method call on the I<meta class>, which is a class managing
it is actually a method call on its I<meta class>, which is a class managing
the properties of the C<Employee> class -- or any other class you are
interested in. This meta class enables other ways of introspection too:
Expand Down
25 changes: 12 additions & 13 deletions doc/Language/containers.pod
Expand Up @@ -28,8 +28,8 @@ container>.
=head1 Scalar containers
Although objects of type C<Scalar> are everywhere in Perl 6, you usually
never see them directly as objects, because most operations
Although objects of type C<Scalar> are everywhere in Perl 6, you rarely
see them directly as objects, because most operations
I<decontainerize>, which means they act on the C<Scalar> container's
contents instead of the container itself.
Expand Down Expand Up @@ -274,19 +274,19 @@ To provide custom containers Perl 6 provides the class C<Proxy>. It takes two
methods that are called when values are stored or fetched from the container.
Type checks are not done by the container itself and other restrictions like
readonlyness can be broken. The returned value must therefore be of the same
type then the type of the variable it is bound to. We can use type captures to
type as the type of the variable it is bound to. We can use type captures to
work with types in Perl 6.
sub lucky(::T $type) {
my T $c-value; # closure variable
return Proxy.new(
FETCH => method (){ $c-value},
STORE => method (T $new-value){
X::OutOfRange.new(what => 'number', got => '13', range => '-Inf .. 12, 14..Inf').throw
if $new-value == 13;
$c-value = $new-value;
}
);
my T $c-value; # closure variable
return Proxy.new(
FETCH => method () { $c-value },
STORE => method (T $new-value) {
X::OutOfRange.new(what => 'number', got => '13', range => '-Inf..12, 14..Inf').throw
if $new-value == 13;
$c-value = $new-value;
}
);
}
my Int $a := lucky(Int);
Expand All @@ -295,4 +295,3 @@ work with types in Perl 6.
say $a = 13; # X::OutOfRange
=end pod

0 comments on commit 9c6a4a7

Please sign in to comment.