NAME

SPVM::Stringer - A Callback Yype to Stringify a Object

SYNOPSYS

use Stringer;

my $stringer : Stringer = method : string ($object : object) {
  my $point = (Point)$object;
  my $x = $point->x;
  my $y = $point->y;
  
  my $string = "($x, $y)";
  
  return $string;
};

my $point = Point->new(1, 2);
my $string = $stringer->($point);

DESCRIPTION

Stringer is an interface type for the callback to stringify a object.

INTERFACE METHOD

required method : string ($object : object)

The implementation must receive a object and return the string expression.