Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Show Associative-like access of Pair
And fix some output comment formatting.
  • Loading branch information
Altai-man committed Mar 8, 2019
1 parent 8bb51f8 commit eac6eda
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions doc/Type/Pair.pod6
Expand Up @@ -74,10 +74,10 @@ possible to change the value from outside of the C<Pair> itself:
=begin code
my $v = 'value A';
my $pair = a => $v;
$pair.say; # OUTPUT: a => value A
$pair.say; # OUTPUT: «a => value A␤»
$v = 'value B';
$pair.say; # OUTPUT: a => value B
$pair.say; # OUTPUT: «a => value B␤»
=end code
Please also note that this behavior is totally unrelated to the way used to
Expand All @@ -93,9 +93,16 @@ my $v = 'value B';
my $pair = a => $v;
$pair.freeze;
$v = 'value C';
$pair.say; # OUTPUT: a => value B
$pair.say; # OUTPUT: «a => value B␤»
=end code
As Pair implements L<Associative|/type/Associative> role, its value can be
accessed using Associative subscription operation. Subscrip adverbs work as well.
=for code
my $pair = a => 5;
say $pair<a>; # OUTPUT: «5␤»
say $pair<a>:exists; # OUTPUT: «True␤»
=head1 Methods
Expand Down

0 comments on commit eac6eda

Please sign in to comment.