Skip to content

Commit

Permalink
Adds ;=
Browse files Browse the repository at this point in the history
Also indexes it. Closes #1855
  • Loading branch information
JJ committed Nov 4, 2018
1 parent 7ad5a08 commit a37af0a
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions doc/Language/operators.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -587,12 +587,14 @@ my %config-hash = $config<>;
say %config-hash.perl; # OUTPUT: «{:files(3), :path("/home/perl6/perl6.pod6")}»
=end code
It's a C<Hash> in both cases, and it can be used like that; however, in the first case it was in item context, and in the second case it has been extracted to its proper context.
It's a C<Hash> in both cases, and it can be used like that; however, in the
first case it was in item context, and in the second case it has been extracted
to its proper context.
=head2 postcircumfix C«< >»
Shortcut for L<C<postcircumfix { }>|/routine/{ }#(Operators)_postcircumfix_{_}> that quotes
its argument using the same rules as the L«quote-words operator|
Shortcut for L<C<postcircumfix { }>|/routine/{ }#(Operators)_postcircumfix_{_}>
that quotes its argument using the same rules as the L«quote-words operator|
/routine/< >#circumfix_<_>» of the same name.
my %color = kiwi => "green", banana => "yellow", cherry => "red";
Expand Down Expand Up @@ -721,15 +723,19 @@ X<Hyper method call operator>. Will call a method on all elements of a C<List> o
say @a».&foo; # So we can pretend to have a method call with a sub that got a good first positional argument.
say @a».&{ .ord}; # Blocks have an implicit positional arguments that lands in $_. The latter can be omitted for method calls.
Hyper method calls may appear to be the same as doing a L<map> call, however along with being a hint to the compiler
that it can parallelize the call, the behaviour is also affected by L<nodality of the method|https://docs.perl6.org/routine/is%20nodal>
being invoked, depending on which either L<nodemap> or L<deepmap> semantics are used to perform the call.
Hyper method calls may appear to be the same as doing a L<map> call, however
along with being a hint to the compiler that it can parallelize the call, the
behaviour is also affected by
L<nodality of the method|https://docs.perl6.org/routine/is%20nodal>
being invoked, depending on
which either L<nodemap> or L<deepmap> semantics are used to perform the call.
The nodality is checked by looking up whether the L<Callable> provides C<nodal> method.
If the hyper is applied to a method, that L<Callable> is that method name, looked up on L<List> type;
if the hyper is applied to a routine (e.g. C<».&foo>), that routine functions as that L<Callable>. If the
L<Callable> is determined to provide C<nodal> method, L<nodemap> semantics are used to perform the hyper call,
otherwise L<duckmap> semantics are used.
The nodality is checked by looking up whether the L<Callable> provides C<nodal>
method. If the hyper is applied to a method, that L<Callable> is that method
name, looked up on L<List> type; if the hyper is applied to a routine (e.g.
C<».&foo>), that routine functions as that L<Callable>. If the L<Callable> is
determined to provide C<nodal> method, L<nodemap> semantics are used to perform
the hyper call, otherwise L<duckmap> semantics are used.
Take care to avoid a
L<common mistake|/language/traps#Using_»_and_map_interchangeably> of expecting
Expand Down Expand Up @@ -798,6 +804,16 @@ class or role, even after it has been redefined in the child class.
}
say Foo.Bar::baz; # OUTPUT: «42␤»
X<|,=>
=head postfix C<,=>
Creates an object that concatenates, in a class-dependent way, the contents of
the variable on the left hand side and the expression on the right hand side:
my %a = :11a, :22b;
%a ,= :33x;
say %a # OUTPUT: «{a => 11, b => 22, x => 33}␤»
=head1 Autoincrement precedence
=head2 prefix X<C«++»|prefix ++>
Expand Down

0 comments on commit a37af0a

Please sign in to comment.