Skip to content

Commit

Permalink
Adds entry for the decont operator closes #2025
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed May 21, 2018
1 parent 3e2d277 commit 9966768
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/Language/containers.pod6
Expand Up @@ -297,7 +297,7 @@ The C<@> character can also be used as a prefix to coerce the argument to a list
my $x = (1, 2, 3);
.say for @$x; # 3 iterations
However, the C«<>» is more appropriate to decontainerize items that aren't
However, the I<decont> operator C«<>» is more appropriate to decontainerize items that aren't
lists:
my $x = ^Inf .grep: *.is-prime;
Expand Down
15 changes: 15 additions & 0 deletions doc/Language/operators.pod6
Expand Up @@ -559,6 +559,21 @@ shortcuts, and L<Subscripts|/language/subscripts> for a more detailed
explanation of this operator's behavior and how to implement support for it
in custom types.
=head2 postcircumfix C«<>»
Decontainerization operator, which extracts the value from a container and makes it independent of the container type.
=begin code
use JSON::Tiny;
my $config = from-json('{ "files": 3, "path": "/home/perl6/perl6.pod6" }');
say $config.perl; # OUTPUT: «${:files(3), :path("/home/perl6/perl6.pod6")}»
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.
=head2 postcircumfix C«< >»
Shortcut for L<C<postcircumfix { }>|/routine/{ }#(Operators)_postcircumfix_{_}> that quotes
Expand Down
4 changes: 2 additions & 2 deletions doc/Language/pod.pod6
Expand Up @@ -158,7 +158,7 @@ sub search-in-seq( Int $end, Int $number ) {
»
=end code
By using a matched pair of parentesis constructs such as C<()> or C<«»> the comments can extend multiple lines. This format, however, will not translate to a multi-line display by C<perl6 -doc>.
By using a matched pair of parenthesis constructs such as C<()> or C<«»> the comments can extend multiple lines. This format, however, will not translate to a multi-line display by C<perl6 -doc>.
=head1 Block types
Expand Down Expand Up @@ -405,7 +405,7 @@ Z<Eventually copy everything from tables.pod6 and put it here>
Pod comments are comments that Pod renderers ignore.
Comments are useful for meta-documentation (documenting the documentation). Single-line coments use the C<comment> keyword:
Comments are useful for meta-documentation (documenting the documentation). Single-line comments use the C<comment> keyword:
=begin code
=comment Add more here about the algorithm
Expand Down

0 comments on commit 9966768

Please sign in to comment.