Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64310 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98180 invoked from network); 16 Dec 2012 21:18:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2012 21:18:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:58342] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/CC-27715-68A3EC05 for ; Sun, 16 Dec 2012 16:17:59 -0500 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id 24783DE13D; Sun, 16 Dec 2012 21:17:56 +0000 (GMT) Date: Sun, 16 Dec 2012 21:17:55 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: Lester Caine cc: PHP internals In-Reply-To: <50CDD0C8.7080607@lsces.co.uk> Message-ID: References: <50C63A7C.8090705@gmail.com> <4DBD0EA5-C45B-4C12-BFE9-E263B255B2C3@strojny.net> <50CDD0C8.7080607@lsces.co.uk> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] DateTime improvement From: derick@php.net (Derick Rethans) On Sun, 16 Dec 2012, Lester Caine wrote: > > > I'm not really against that, but we do need to use the Date namespace - > > > >>so DateTimeImmutable. It might be trickier to do than it sounds > > > >>though... > > > > > > I've started hacking on this - with some luck I'm done before PHP 5.5 > > > beta1. > > Am I missing something here? > Isn't this just making the object content read only? Sortof. But as that is how things work, making an immutable variant isn't that easy. > Haven't we been having a separate discussion on that? > > On the whole I'm only using DateTime objects when I need to display the > content in a different timezone, so the timezone needs to be changeable, but > the base date is read only. Alternatively I'm building a calendar so need 'all > the days for month x' as an array, and then use those dates to generate the > database query. If it's a 'local' calendar then there will be a time offset > incorporated as well. Al the methods will *still* return the modified DateTime object - it's just that the one that you *call* f.e. ->modify() on won't change anymore. cheers, Derick