Permalink
Browse files

Give minimal info about methods for Positional/Associative roles

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 02a64553dcdaad6e17b2ea131745fafb345b8143
Showing with 42 additions and 0 deletions.
  1. +17 −0 doc/Type/Associative.pod6
  2. +25 −0 doc/Type/Positional.pod6
View
@@ -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
View
@@ -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.