On Wed, 6 Jul 2005, John Peacock wrote:
At the risk of sounding flippant, why not rename the existing DateTime class to DateTime::Fat (or the less inflamatory DateTime::Base) and put the proposed module in it's place as DateTime. If it is designed well, everything should Just Work(TM) with the shim class, which should always be faster than the existing class, even with the extra dispatch to plump up the object when needed.

At first I thought this might be a good idea ..

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


This needs to be an *alternate* rather than standard way of creating DateTime objects, and the documentation will basically just tell you that you need to be very aware of the lack of immediate validation.

Cheers!
Rick Measham

Reply via email to