Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66048 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81518 invoked from network); 20 Feb 2013 10:30:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2013 10:30:14 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:35573] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4C/FB-19387-4B5A4215 for ; Wed, 20 Feb 2013 05:30:13 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 0368970004B2; Wed, 20 Feb 2013 10:30:10 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id O81E5kbdsc93; Wed, 20 Feb 2013 10:30:09 +0000 (WET) Received: from nebm.ist.utl.pt (unknown [IPv6:2001:690:2100:4::58:1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 860BB70006F2; Wed, 20 Feb 2013 10:21:54 +0000 (WET) Received: from localhost ([127.0.0.1] helo=nebm.ist.utl.pt) by nebm.ist.utl.pt with esmtp (Exim 4.72) (envelope-from ) id 1U86oE-0004zE-FG; Wed, 20 Feb 2013 10:21:54 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 20 Feb 2013 11:21:54 +0100 To: Stas Malyshev Cc: Derick Rethans , Organization: =?UTF-8?Q?N=C3=BAcleo_de_Engenharia_Biom=C3=A9dica_do_Insti?= =?UTF-8?Q?tuto_Superior_T=C3=A9cnico?= In-Reply-To: <51249818.2040308@sugarcrm.com> References: <1867201214.20130215192512@cypressintegrated.com> <51248C24.4070609@sugarcrm.com> <51249818.2040308@sugarcrm.com> Message-ID: X-Sender: glopes@nebm.ist.utl.pt User-Agent: RoundCube Webmail/0.8-rc Subject: Re: [PHP-DEV] Questions regarding DateTimeImmutable From: glopes@nebm.ist.utl.pt (Gustavo Lopes) Em 2013-02-20 10:32, Stas Malyshev escreveu: > This isn't really a good data since most of this code creates its own > DateTime and thus there's very little relevancy to what we're talking > about. If you look up the functions that actually accept DateTime: > > > http://code.google.com/codesearch#search/&type=cs&q=DateTime%5Cs%5C$%20lang:%5Ephp$ > > the picture would be quite different. I scanned through first 5 pages > and couldn't find a function that actually calls modify() on DateTime > object it receives. Well, the majority of the code here just calls ->format() (which may very well be considered a point in your favor). But again most of the time an operation with side effects is called, there's no assignment. I also went through the first pages and saw one instance of an operation with side effects with assignment and three others without (setTime, setTimestamp and setTimeZone). It's very tedious to go through this because most that don't just call format just set a field with it. This is potentially dangerous, of course, depending on what's further done with the field. In any case, this seems like a pointless exercise. The solution is simple: separate the classes and provide a toDateTime() on DateTimeImmutable for interoperability purposes. One wouldn't need to go through Atom libraries code to know this is a solution that can't cause problems. -- Gustavo Lopes