develooper Front page | perl.datetime | Postings from January 2003

Re: [mplspm]: Picking up the ball

Thread Previous | Thread Next
David Wheeler
January 13, 2003 10:07
Re: [mplspm]: Picking up the ball
Message ID:
On Sunday, January 12, 2003, at 11:42  PM, Matt Sergeant wrote:

> Parsing should not be in a base date time class though - it has no 
> place
> there. It should *return* a base date time object, but putting 
> generators in
> the same class doesn't make sense to me. I suppose you could look at 
> them as
> constructors, but I'd disagree with that. A constructor should 
> instantiate
> an object via the simplest means possible. Everything else should go 
> in an
> external class (and if you like that class can inject methods into the 
> base
> class, but no date parsing whatsoever should go into the base class 
> IMHO).

I disagree. I think that some very fundamental parsing needs to go into 
the base class. You should be able to construct a DateTime object for 
whatever date and time you need, and to do that, it has to be able to 
parse a date/time argument. But nothing fancy, just a few formats 
should be supported in the base class, including epoch time, ICal, and 
maybe ISO 8601. Other than that, I agree that all other date parsing 
should go into another module.



David Wheeler                                     AIM: dwTheory                                 ICQ: 15726394                      Yahoo!: dew7e

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About