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

Re: [mplspm]: Picking up the ball

Thread Previous | Thread Next
From:
David Wheeler
Date:
January 13, 2003 10:07
Subject:
Re: [mplspm]: Picking up the ball
Message ID:
D2AC8084-2721-11D7-A08F-000393D9436A@wheeler.net
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.

Regards,

David

-- 
David Wheeler                                     AIM: dwTheory
david@wheeler.net                                 ICQ: 15726394
http://david.wheeler.net/                      Yahoo!: dew7e
                                                Jabber: Theory@jabber.org


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