The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SPVM::Stringer - Stringer in SPVM | a callback interface 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 a callback interface to stringify a object.

CALLBACK METHOD INTERFACE

  method : string ($object : object)

This method receives a object and return the string expression.

This method is planned to be implemented in other classes.