On Mon, 28 Jun 2010, Felix Tubiana via RT wrote:
Show quoted text> Mon Jun 28 12:24:09 2010: Request 58907 was acted upon.
> Transaction: Ticket created by FELIX
> Queue: Moose
> Subject: Moose predicate with default
> Broken in: 0.92
> Severity: Wishlist
> Owner: Nobody
> Requestors: felixtubiana@gmail.com
> Status: new
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=58907 >
>
>
> Apologies if this has already been addressed.
>
> When defining an attribute, it would be useful to emit a warning or an
> error when trying to use both predicate and default, as the default
> overrides the usefulness of the predicate function, which is probably
> not what the user intends.
>
> has( 'foo_param' => ( is => 'rw',
> isa => 'Bool',
> predicate => 'has_foo_param',
> default => 0
> )
> );
This is a little more complicated than you might think. If the attribute
has a clearer, then the predicate is still useful. Similarly, if the
attribute is lazy, then the predicate is useful.
Then factor in the possibility that some MooseX module will affect the
logic here, and I think it's unrealistic to expect Moose to warn on this
sort of thing.
-dave
/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/