Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66495 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1429 invoked from network); 6 Mar 2013 15:50:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2013 15:50:49 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.175 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.175 mail-ob0-f175.google.com Received: from [209.85.214.175] ([209.85.214.175:44720] helo=mail-ob0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/54-03015-8D567315 for ; Wed, 06 Mar 2013 10:50:48 -0500 Received: by mail-ob0-f175.google.com with SMTP id uz6so3678110obc.34 for ; Wed, 06 Mar 2013 07:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=E6l6OOMXSlCud2ClA7/qPN5CmGMeW3ln8ZRdyY36fV8=; b=BacQVDvWgLiLNutZ7UTN7m5v3GPDwZBJtvEH6EXE6iUJ3Z4HZJZzuvBLYn/Q6B6bNd 9Odo1HCJGz3iiUHb9izgGZnM+ztnvPvvfh5qPnit2/neNi7dH/cmpT8OykSJ0X0qU0V6 /cs6uMYCyxNPwjCkMsrxUi/d97lOtuDjhfYNf/kKrt6lqOfQ7Bte90w7kd/iuW+mhFk/ dnXdwHzPg/27uepbN6gH1LsOU2IGxc5oeT+LjCCw1AhQS3RUxtIneAfkdKq2z7itM5/L 9eRlnx8TpgkfIrTJAnH4R8lxthrYhJtr+k9pA5rK2Z3oMdev/4Ut/rTuDcRCSnXhN8aG Q2SQ== MIME-Version: 1.0 X-Received: by 10.60.11.228 with SMTP id t4mr12204305oeb.42.1362585046166; Wed, 06 Mar 2013 07:50:46 -0800 (PST) Received: by 10.182.49.136 with HTTP; Wed, 6 Mar 2013 07:50:46 -0800 (PST) In-Reply-To: References: <1867201214.20130215192512@cypressintegrated.com> <51248C24.4070609@sugarcrm.com> <51249818.2040308@sugarcrm.com> Date: Wed, 6 Mar 2013 16:50:46 +0100 Message-ID: To: Gustavo Lopes Cc: Stas Malyshev , Derick Rethans , PHP internals Content-Type: multipart/alternative; boundary=e89a8fb1ed06a7379504d7438d12 Subject: Re: [PHP-DEV] Questions regarding DateTimeImmutable From: nikita.ppv@gmail.com (Nikita Popov) --e89a8fb1ed06a7379504d7438d12 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Feb 20, 2013 at 11:21 AM, Gustavo Lopes wrote: > 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. > This seems like a reasonable suggestion. If no such compromise can be reached, then I would suggest that the DateTimeImmutable addition be reverted altogether. Looking over the thread it seems that most people agree on the design flaws and those who don't are more or less indifferent about DateTimeImmutable either way (e.g. Stas). I'd prefer to have nothing over having something bad. Nikita --e89a8fb1ed06a7379504d7438d12--