Re: Today in Cairo Apr 25 2008

[email protected] (Dave Rolsky)
Newsgroups perl.datetime
Message-ID <[email protected]>
On Wed, 20 Feb 2008, Dr.Ruud wrote:

> Maybe add a "safe => 1" (with new, add, subtract) such that the 
> following don't die() anymore:

I'm not too keen on this, because it clutters up the API and puts too much 
burden on the end user to know about the possibility of "unsafe" datetime 
math.

Either the operations should be safe by default, or unsafe by default, in 
which case there should be a documented workaround.

In fact, the workaround is to convert the object to UTC before doing any 
math on it, which may or may not get the results you want.

> Somewhat related: Maybe also add a newdate() that carries no time
> information.

You can effectively get this by simply using the floating time zone and 
never setting or altering any time components of the object.

If I had it to do all over again (which I guess I will if I work on this 
stuff for Perl 6), then I'd make a DateTime::Date class and simply use 
that class as part of DateTime::DateTime (err, names pending review).


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.