Cor hè un sistema OOP alternativu per Perl

Vede u ligame per un paragone di Cor è Moose. Codice di mostra:

puntu di classa {
hà ( $x, $y ) :reader :writer :new :isa(Int);

metudu chjaru () {
( $x, $y ) = ( 0, 0 );
}
}

class Point3D hè un Puntu {
hà $z :reader :writer :new :isa(Int);

metudu chjaru () {
$self->next::metudu;
$z = 0;
}
}

Source: linux.org.ru

Add a comment