On Sat, Jun 19, 2010 at 06:27:18PM +0300, Octavian Rasnita wrote:
> From: "Jesse Luehrs" <[email protected]>
> > On Sat, Jun 19, 2010 at 05:15:44PM +0300, Octavian Rasnita wrote:
> >> Hi,
> >> 
> >> Just as a curiosity, why the following syntax works:
> >> 
> >> has $_ => (is => 'rw', isa => 'Str') for 'a' .. 'zz';
> >> 
> >> but the following one doesn't:
> >> 
> >> has $_ => (is => 'rw', isa => 'Str') for 'a' .. 'zzz';
> >> 
> >> Is the number of attributes that can be defined limited?
> >> 
> >> Thanks.
> >> 
> >> Octavian
> > 
> > The second one will eventually do
> > 
> >  has 'has' => (is => 'rw', isa => 'Str')
> > 
> > which installs a method called 'has', which overwrites the 'has'
> > function for creating attributes. When it gets to has 'hat', it'll be
> > calling the accessor that was just installed, not the Moose keyword.
> > 
> > -doy
> 
> Ok, thanks. Now I understand. I thought that the reserved words are somehow 
> restricted or skipped, but I've seen that Moose allows using
> 
> has has => (is => 'rw');
> 
> Octavian

I've added a warning for this case on the branch
topic/accessor_overwrite_function_warning.

-doy

Reply via email to