develooper Front page | perl.moose | Postings from June 2011

Re: Moose Type Constraints violations to warnings?

Thread Previous | Thread Next
From:
Stevan Little
Date:
June 13, 2011 09:16
Subject:
Re: Moose Type Constraints violations to warnings?
Message ID:
8914E912-B2AE-45A2-AC2D-020F6089C3DE@iinteractive.com
I second Dave's idea here.

The only other approach (and I have no idea if this would work or even make since because it has been a long time since I swam in this codebase) would be to take the Moose::Error framework and split it up a little more so that there is a Moose::Error::ForTypeConstraints and then be able to overload that so that you could have Moose::Error::ForTypeConstraint::JustWarn or something. 

- Stevan


On Jun 13, 2011, at 11:36 AM, Dave Rolsky wrote:

> On Mon, 13 Jun 2011, Ovid wrote:
> 
>> I don't want to turn off the type checks. I would just like some of them to be warnings if we're in production.
>> 
>> I agree completely with the *concept* of the strict type constraints, but 
>> 
>> 
>>   "In theory, theory and practice are the same.
>>   In practice, we're trying to comb spaghetti."
>>   Abraham Lincoln, 1912 speech to the Republican Women's De-emancipation Convention
>> 
>> If a hotel's "short description" must be no longer than 200 characters, they would much prefer to have the first 200 characters of their hotel's 250-character description displayed rather than nothing.
> 
> You can use coercions to do this, can't you? You could even warn inside the coercion.
> 
> 
> -dave
> 
> /*============================================================
> http://VegGuide.org               http://blog.urth.org
> Your guide to all that's veg      House Absolute(ly Pointless)
> ============================================================*/


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About