++ed by:
KRAUTCAT HAMMER MHOWARD VEESH BEROV
7 non-PAUSE users
Author image Yuki Kimoto

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.