| 1 | package SPVM::Stringable; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::Stringable - Stringable Interface | ||
| 8 | |||
| 9 | =head1 Usage | ||
| 10 | |||
| 11 | class Point { | ||
| 12 | interface Stringable; | ||
| 13 | |||
| 14 | method to_string : string () { | ||
| 15 | |||
| 16 | my $x = $sel->x; | ||
| 17 | my $y = $sel->y; | ||
| 18 | |||
| 19 | my $string = "($x,$y)"; | ||
| 20 | |||
| 21 | return $string; | ||
| 22 | }; | ||
| 23 | } | ||
| 24 | |||
| 25 | =head1 Description | ||
| 26 | |||
| 27 | Stringable interface in L<SPVM> is the interface for stringable classes. | ||
| 28 | |||
| 29 | =head1 Interface Methods | ||
| 30 | |||
| 31 | =head2 to_string | ||
| 32 | |||
| 33 | C<required method to_string : string ();> | ||
| 34 | |||
| 35 | Returns the string representation for the instance. | ||
| 36 | |||
| 37 | =head1 Copyright & License | ||
| 38 | |||
| 39 | Copyright (c) 2023 Yuki Kimoto | ||
| 40 | |||
| 41 | MIT License |