Hi Tobias, On Mon, Jan 31, 2011 at 2:08 PM, Tobias Schlitt <tob...@schlitt.info> wrote:
> Hi, > > I had a quick chat with Derick during PHP Benelux about this patch. He > suggested to make the DateTime objects in Template immutable. I'm pretty > much for doing so and would actually desire to change that in PHP > itself, if it would be possible. > > Making DateTime objects immutable would result in much more sane > behavior of date_modify(), date_add() and friends, since they would no > more change the original object, but return a new one which has the > desired manipulation applied. > > We've an implementation for immutable DateTime lying around, which we > could just move to Base/ so it's available for others easily, too. Find > the code attached. > > What do you think? > Totally agree. BTW your implementation of the DateTime extension looks a bit too complex. Do we really need all these private function *add() methods ? Wouldnt'it be possible to just avoid them and move their contents to the public ones ? I may have overlooked something though. +1 for moving the code to Base anyway. :) -- Jérôme Renard http://39web.fr | http://jrenard.info | http://twitter.com/jeromerenard