Skip to content

Commit

Permalink
Give minimal info about methods for Positional/Associative roles
Browse files Browse the repository at this point in the history
We should at least mention the methods that *must* be implemented.
And we should refer to the extended information: since I had no clue
as to how to properly refer to this internal information in a link,
I've just use the URL (which apperently happens more often).  If this
is incorrect, please fix  :-)
  • Loading branch information
lizmat committed Sep 14, 2018
1 parent 46dff36 commit 02a6455
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/Type/Associative.pod6
Expand Up @@ -66,6 +66,23 @@ you use the parametrized version of Associative.
my %any-hash;
%any-hash.keyof; #OUTPUT: «(Str(Any))␤»
=head1 Methods that should be provided
=head2 method AT-KEY
method AT-KEY(key) { }
Should return the value / container at the given key.
=head2 method EXISTS-KEY
method EXISTS-KEY(key) { }
Should return a C<Bool> indicating whether the given key actually has a value.
=head1 See also
See L<Methods to implement for positional subscripting|https://docs.perl6.org/language/subscripts#Methods_to_implement_for_associative_subscripting> for information about additional methods that can be implemented for the C<Associative> role.
=end pod

Expand Down
25 changes: 25 additions & 0 deletions doc/Type/Positional.pod6
Expand Up @@ -19,6 +19,31 @@ include L<List>, L<Array>, L<Range>, and L<Buf>.
Returns the type constraint for elements of the positional container. Defaults
to L<Mu>.
=head1 Methods that should be provided
=head2 method elems
method elems() { }
Should return the number of available elements in the instantiated object.
=head2 method AT-POS
method AT-POS(position) { }
Should return the value / container at the given position.
=head2 method EXISTS-POS
method EXISTS-POS(position) { }
Should return a C<Bool> indicating whether the given position actually has a
value.
=head1 See also
See L<Methods to implement for positional subscripting|https://docs.perl6.org/language/subscripts#Methods_to_implement_for_positional_subscripting> for information about additional methods that can be implemented for the C<Positional> role.
=end pod

# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 comments on commit 02a6455

Please sign in to comment.