----- Original Message ----
> From: Jesse Luehrs <[email protected]>
> Hmmm, maybe we need a more intelligent check then. I do think that
> overwriting an existing accessor like this shouldn't be allowed... it
> implies functionality that really isn't possible.
Well, Moose already allows some pretty dubious things with accessors. Consider
the following:
{
package One;
use Moose;
has counter => ( is => 'rw', isa => 'Int', default => 1 );
sub inc_counter {
my $self = shift;
$self->counter( $self->counter + 1 );
}
}
{
package Two;
use Moose;
extends 'One';
has '+counter' => ( isa => 'Bool' );
}
my $two = Two->new;
say $two->counter;
$two->inc_counter;
That's a runtime bug which probably shouldn't be there, but Moose doesn't
really have a way of detecting that. Being able to change your 'isa' is
arguably worse than being able to add a trigger :)
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6