Re: Patch: Marking DateTime Instances Immutable
| From: | Benjamin Eberlei | Date: | Sun, 05 Dec 2010 19:36:16 +0000 |
| Subject: | Re: Patch: Marking DateTime Instances Immutable | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50861@lists.php.net to get a copy of this message | ||
On Sun, 05 Dec 2010 10:29:29 -0800
Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
> > I propose to allow to work with DateTime objects that are marked as
> > immutable optionally. This means that all methods add, sub, modify,
>
> I think it's a bad idea, which would instantly break all the code that
> assumes different semantics. Yes, I noticed the word optional, however,
> the code accepting DateTime assumes some semantics, and had no means to
> reject object with different semantics, and combining two semantics in
> one class is a bad idea.
>
> On the other hand, you can create DateTimeValue object, which can do
> what you want. I'd imagine it'd be quite easy to do in user space too.
> If enough people feel they need it then it can be brought into the
> extension too.
Hey Stas,
i actually implemented this in userland, but its rather ugly:
http://whitewashing.de/blog/124
I'd like to see it in the extension, the patch was just the only thing i could do with my
limited C skills ;-) It is better to start the discussion with something visible rather than just
speaking about hypothetical changes :-)
>
> > I also talked to Derick about this and he agrees that immutable DateTime
> > objects would be desirable. I have talked to many other people who agreed
> > that the current behavior is weird.
>
> I've talked to many people who agree it isn't ;)
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>