Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reflow and hashtag correction
Can't figure out what the TODO refers to, so it's just eliminated. Refs #2277
  • Loading branch information
JJ committed Aug 30, 2018
1 parent 198f0ac commit 5954ab0
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions doc/Language/syntax.pod6
Expand Up @@ -659,7 +659,7 @@ See the L<Signatures|/type/Signature> documentation for more about signatures.
my Int $x where * > 3 = 7; # same constraint, but using L<Whatever> shorthand
See L<Variable Declarators and
Scope|/language/variables#Variable_Declarators_and_Scope>
Scope|/language/variables#Variable_declarators_and_scope>
for more details on other scopes (our, has).
=head3 Subroutine declaration
Expand Down Expand Up @@ -716,15 +716,12 @@ Inside of a class, you can also declare multi-dispatch methods.
=head1 Subroutine calls
Subroutines are created with the keyword C<sub> followed
by an optional name, an optional signature and a code block.
Subroutines are lexically scoped, so if a name is specified
at the declaration time, the same name can be used
in the lexical scope to invoke the subroutine.
A subroutine is an instance of type L<Sub|/type/Sub> and
can be assigned to any container.
=comment TODO
Subroutines are created with the keyword C<sub> followed by an optional
name, an optional signature and a code block. Subroutines are lexically
scoped, so if a name is specified at the declaration time, the same name
can be used in the lexical scope to invoke the subroutine. A subroutine
is an instance of type L<Sub|/type/Sub> and can be assigned to any
container.
=begin code :skip-test
foo; # Invoke the function foo with no arguments
Expand All @@ -737,8 +734,8 @@ can be assigned to any container.
When declared within a class, a subroutine is named "method": methods
are subroutines invoked against an object (i.e., a class instance).
Within a method the special variable C<self> contains the object instance
(see L<Methods|/language/classtut#Methods>).
Within a method the special variable C<self> contains the object
instance (see L<Methods|/language/classtut#Methods>).
=begin code :preamble<class Person {
has Int $.age;
Expand All @@ -758,13 +755,13 @@ For more information see L<functions|/language/functions>.
=head2 Precedence drop
In the case of method invocation (i.e., when invoking a subroutine against
a class instance) it is possible to apply the C<precedence drop>, identified
by a colon C<:> just after the method name and before the argument list.
The argument list takes precedence over the method call, that on the other
hand "drops" its precedence. In order to better understand consider
the following simple example (extra spaces have been added just to align
method calls):
In the case of method invocation (i.e., when invoking a subroutine
against a class instance) it is possible to apply the C<precedence
drop>, identified by a colon C<:> just after the method name and before
the argument list. The argument list takes precedence over the method
call, that on the other hand "drops" its precedence. In order to better
understand consider the following simple example (extra spaces have been
added just to align method calls):
=begin code :skip-test
my $band = 'Foo Fighters';
Expand All @@ -780,11 +777,12 @@ yields precedence to the rightmost one.
See L<Operators|/language/operators> for lots of details.
Operators are functions with a more symbol heavy and composable syntax. Like
other functions, operators can be multi-dispatch to allow for context-specific
usage.
Operators are functions with a more symbol heavy and composable syntax.
Like other functions, operators can be multi-dispatch to allow for
context-specific usage.
There are five types (arrangements) for operators, each taking either one or two arguments.
There are five types (arrangements) for operators, each taking either
one or two arguments.
=begin code :skip-test
++$x # prefix, operator comes before single input
Expand Down

0 comments on commit 5954ab0

Please sign in to comment.