On Thu, 7 Jul 2005, Rick Measham wrote:

Dave Rolsky wrote:
It has a pretty different API, in that it's new() constructor accepts anything without validation.

I suppose it could check for extra args and call DateTime::Fat->new() if needed.

I think that'd be a possibility, but it'd have to pass the DateTime.pm test suite in that case.

We'd need to bring complete validation back in though. Otherwise your object dies unexpectedly later on:

$dt = DateTime::Diet->new( year => 2004, month => 232 );

print $dt->year;
#2004

print $dt->month;
#232

print $dt->monthname;
# DIE: Illegal value passed to DateTime::new

Yeah, this occurred to me after I wrote that. Having these sorts of "delayed" errors is very bad and surprising for users.

Rick's code is well suited to instances where you have data that you've already checked, but not so good for general purpose usage.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Reply via email to