| 1 | package SPVM::Countable; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::Countable - Countable Interface | ||
| 8 | |||
| 9 | =head1 Usage | ||
| 10 | |||
| 11 | class Point { | ||
| 12 | interface Countable; | ||
| 13 | |||
| 14 | has elements : int[] | ||
| 15 | |||
| 16 | method length : string () { | ||
| 17 | |||
| 18 | my $length = @{$self->{elements}}; | ||
| 19 | |||
| 20 | return $length; | ||
| 21 | }; | ||
| 22 | } | ||
| 23 | |||
| 24 | =head1 Description | ||
| 25 | |||
| 26 | Countable interface in L<SPVM> is the interface for countable classes. | ||
| 27 | |||
| 28 | =head1 Interface Methods | ||
| 29 | |||
| 30 | =head2 to_string | ||
| 31 | |||
| 32 | C<required method length : int ();> | ||
| 33 | |||
| 34 | Meants to return the lenght of the elements. | ||
| 35 | |||
| 36 | =head1 Copyright & License | ||
| 37 | |||
| 38 | Copyright (c) 2023 Yuki Kimoto | ||
| 39 | |||
| 40 | MIT License |