Dave et al,

First off, thank you for your work on DateTime. I'm sure you have heard
this many times, but I use it in pretty much every project and really
appreciate it. Thank you.

On to the meat...

I've begun using a module that is DateTime subclass, and I'm considering
releasing it. I was hoping to get some feedback from the DateTime team
before going too far down the road.

The module addresses an issue that I have repeatedly run into when using
DateTime: mutability. DateTime works as advertised, and the bugs introduced
are 100% due to my mistakes, but I don't think I'm alone in introducing
bugs by inadvertently modifying a DateTime object.

I know there are a couple of modules that attempt to address this in some
way. I've used DateTime::Moonpig before, but it never quite fits the bill.
I still want to be able to call the set and truncate methods, I just don't
want the original DateTime object to be modified. I also don't need the
other changes Moonpig introduces.

So, I'm considering releasing "DateTimeX::Immutable" (name open for
discussion). It overrides most of the same methods that DateTime::Moonpig
does, but instead of croaking, it clones the DateTime object then returns
the result. It is actually implemented it as a role (using Role::Tiny) so
it can be composed into other custom subclasses. It is a very simple module
with minimal code (something I've generally found to be good thing).

An initial version is available on github (
https://github.com/mvgrimes/perl-datetimex-immutable). I would be happy to
contribute the code to the DateTime project there is interest. Thanks for
your input!

Best regards,
Mark
mgri...@cpan.org

Reply via email to