Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17179 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30493 invoked by uid 1010); 8 Jul 2005 00:17:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30478 invoked from network); 8 Jul 2005 00:17:05 -0000 Received: from unknown (HELO dotgeek.org) (127.0.0.1) by localhost with SMTP; 8 Jul 2005 00:17:05 -0000 X-Host-Fingerprint: 84.57.3.205 dsl-084-057-003-205.arcor-ip.net Received: from ([84.57.3.205:29259] helo=localhost.localdomain) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 93/0F-59389-106CDC24 for ; Thu, 07 Jul 2005 20:17:05 -0400 To: internals@lists.php.net Date: Fri, 8 Jul 2005 02:17:23 +0200 Message-ID: <20050708021723.46bb4484.pierre@dotgeek.org> References: <5.1.0.14.2.20050707164528.02833cc0@localhost> X-Newsreader: Sylpheed version 2.0.0beta1 (GTK+ 2.4.14; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Posted-By: 84.57.3.205 Subject: Re: [PHP-DEV] date/timezone classes From: pierre@dotgeek.org (Pierre-Alain Joye) On Thu, 07 Jul 2005 16:56:51 -0700 andi@zend.com (Andi Gutmans) wrote: > Hey Derick, > > If you're just wrapping the date type with a class, I don't see > why it shouldn't be a resource. It'd give you the same thing but > would be easier to implement (unless I'm missing something). > I realize you personally aren't fond of OO but it actually would > work very nicely with a Date class. I'm not talking about OO as > in over-architecting and having a huge hierarchy but just having > easy to use methods on the Date/TimeZone classes (one simple > level). > > It would look the following: > > $timeZone->getName(); > vs. > date_timezone_get($date); > > $date->getOffset(); > vs. > date_offset_get($date); I fully agree with that. I'm not a OO fanatic (meaning using OO for every little variable around) but date/time values are perfect candidate for objects (see pecl/date again for example). Object properties fetching are fast if well implemented. They allow to easily create loops and other steped operations. This kind of API was also why I asked to add TZ aliases support. Having 2 tables and a double lookup is not really a good idea ;). > Personally, unrelated to OO I think it's a nicer and cleaner way > of exposing such an API. It would also make it easier for some of > the other new extensions like SimpleXML, SOAP, PDO , etc. to take > advantage of it when exposing data types. This is what I talk about when I say a common Date object in php. Derick exported the headers on my demand, this is a good first step. > I think this should be seriously considered. I'll be happy to > work with you on this if it makes sense to you and others. > I think that this functionality is best to be developed in > parallel to 5.1. As it would be new unrelated functionality, I > think we could introduce it in 5.1.x after 5.1.0 is out and once > everyone feels comfortable with it. I don't think rushing it into > 5.1.0 is a good idea especially if my feedback is considered. If the 5.1.x that will have that is not too close from 5.1 (new job on 8th august...), I have some really good additions, they are nearly all unit tested, remains some doc ;). I will commit part of it in the next weeks (minus TZ as it conflicts with Derick's one...) As I said in another post, I do not have either the time or the motivations to port everything to ext/date. I partially disagree on some design choices and pecl/date has been totally ignored by Derick, that does not help :). Having the current code in 5.1.0 for some weeks will help to fix it and find possible issues, errors, or needs requested by extension developers. Then we can safely add this new API as experimental for the 1st release. Once everyone agrees (or no one complained), we will freeze it. Regards, --Pierre