I just wrote and uploaded Perl6::Attributes to CPAN. It came out of frustration for code like this:
sub populate {
my ($self, $n) = @_;
for (1..$n) {
push @{$self->{organisms}}, Organism->new(rand($self->{width}), rand($self->{height}));
}
}
Which I can now write like this:
sub populate {
my ($self, $n) = @_;
for (1..$n) {
push @.organisms, Organism->new(rand($.width), rand($.height));
}
}
Much nicer, no?
