@@ -659,7 +659,7 @@ See the L<Signatures|/type/Signature> documentation for more about signatures.
659
659
my Int $x where * > 3 = 7; # same constraint, but using L < Whatever > shorthand
660
660
661
661
See L < Variable Declarators and
662
- Scope|/language/variables#Variable_Declarators_and_Scope >
662
+ Scope|/language/variables#Variable_declarators_and_scope >
663
663
for more details on other scopes (our, has).
664
664
665
665
= head3 Subroutine declaration
@@ -716,15 +716,12 @@ Inside of a class, you can also declare multi-dispatch methods.
716
716
717
717
= head1 Subroutine calls
718
718
719
- Subroutines are created with the keyword C < sub > followed
720
- by an optional name, an optional signature and a code block.
721
- Subroutines are lexically scoped, so if a name is specified
722
- at the declaration time, the same name can be used
723
- in the lexical scope to invoke the subroutine.
724
- A subroutine is an instance of type L < Sub|/type/Sub > and
725
- can be assigned to any container.
726
-
727
- = comment TODO
719
+ Subroutines are created with the keyword C < sub > followed by an optional
720
+ name, an optional signature and a code block. Subroutines are lexically
721
+ scoped, so if a name is specified at the declaration time, the same name
722
+ can be used in the lexical scope to invoke the subroutine. A subroutine
723
+ is an instance of type L < Sub|/type/Sub > and can be assigned to any
724
+ container.
728
725
729
726
= begin code :skip-test
730
727
foo; # Invoke the function foo with no arguments
@@ -737,8 +734,8 @@ can be assigned to any container.
737
734
738
735
When declared within a class, a subroutine is named "method": methods
739
736
are subroutines invoked against an object (i.e., a class instance).
740
- Within a method the special variable C < self > contains the object instance
741
- (see L < Methods|/language/classtut#Methods > ).
737
+ Within a method the special variable C < self > contains the object
738
+ instance (see L < Methods|/language/classtut#Methods > ).
742
739
743
740
= begin code :preamble<class Person {
744
741
has Int $.age;
@@ -758,13 +755,13 @@ For more information see L<functions|/language/functions>.
758
755
759
756
= head2 Precedence drop
760
757
761
- In the case of method invocation (i.e., when invoking a subroutine against
762
- a class instance) it is possible to apply the C < precedence drop > , identified
763
- by a colon C < : > just after the method name and before the argument list.
764
- The argument list takes precedence over the method call, that on the other
765
- hand "drops" its precedence. In order to better understand consider
766
- the following simple example (extra spaces have been added just to align
767
- method calls):
758
+ In the case of method invocation (i.e., when invoking a subroutine
759
+ against a class instance) it is possible to apply the C < precedence
760
+ drop > , identified by a colon C < : > just after the method name and before
761
+ the argument list. The argument list takes precedence over the method
762
+ call, that on the other hand "drops" its precedence. In order to better
763
+ understand consider the following simple example (extra spaces have been
764
+ added just to align method calls):
768
765
769
766
= begin code :skip-test
770
767
my $band = 'Foo Fighters';
@@ -780,11 +777,12 @@ yields precedence to the rightmost one.
780
777
781
778
See L < Operators|/language/operators > for lots of details.
782
779
783
- Operators are functions with a more symbol heavy and composable syntax. Like
784
- other functions, operators can be multi-dispatch to allow for context-specific
785
- usage.
780
+ Operators are functions with a more symbol heavy and composable syntax.
781
+ Like other functions, operators can be multi-dispatch to allow for
782
+ context-specific usage.
786
783
787
- There are five types (arrangements) for operators, each taking either one or two arguments.
784
+ There are five types (arrangements) for operators, each taking either
785
+ one or two arguments.
788
786
789
787
= begin code :skip-test
790
788
++$x # prefix, operator comes before single input
0 commit comments