On Wed, 22 Mar 2006, Garrett, Philip (MAN-Corporate) wrote:
On Tue, 21 Mar 2006, Garrett, Philip (MAN-Corporate) wrote:
My aversion is more philosophical than practical. I'm working on
internationalizing some software right now, and (of course) one of
the main goals is to decouple presentation from data. I chose
DateTime for my date needs only to later find that the presentation
(locale/output time zone) for this core support module is embedded
in its data. It's the very thing I've been struggling against for
months.
I'm actually quite surprised that *you* don't see this as a problem.
The alternative would be to require a locale object to be passed in
to every call to month_name(), month_abbr(), day_name(), and
day_abbr(). Philosophical purity of design lost out over massive
convenience in use.
I understand. I'm sure formatting the date directly from the date object
(as opposed to with a formatter) is by far the most common usage.
Now, I could allow an _optional_ locale object argument if that'd make
it easier for folks to use. But I certainly don't want those methods
to blow up if you call them without any args.
Well, my goal is to have $formatter->format_datetime($date) use
the $formatter's time zone and locale. If this would help to that end,
I'm all for it.
This can be done easily enough with a call to ->clone, so I think it's
best left alone. In particular, if you want to change the time zone,
that's quite different from the locale.
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/