4 ms·
umm, verbosity? package Point; use Moose; # automatically turns on strict and warnings has 'x' => (is => 'rw', isa => 'Int'); has 'y' => (is => 'rw', i
by singingfish 14y ago
umm, verbosity?
package Point;
use Moose; # automatically turns on strict and warnings
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');
sub clear { my $self = shift; $self->$_(0) for qw/x y/}
1;
- colomon 14y agoVerbosity. class Point { has Int $.x is rw; has Int $.y is rw; method clear() { $.x = 0; $.y = 0; } } :)
- dkoch 14y agoPerl 6 is / will be sweet :)
- colomon 14y agoPerl 6 is sweet, and will be sweeter when it has better performance. :)
- deleted 14y ago[deleted]
- singingfish 14y agoLooks like a noble attempt to remove perl5 and ruby pain in the arse points simultaneously. Wonder if it will ever come to anything ...?
- draegtun 14y agoPerl 5.18 may have the following: use mop; class Point { has $x = 0; has $y = 0; method clear { ($x, $y) = (0, 0) } } ref: https://github.com/stevan/p5-mop/blob/master/t/000-examples/001-basic-example.t https://github.com/stevan/p5-mop/blob/master/t/000-examples/...