Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86487 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62409 invoked from network); 4 Jun 2015 09:04:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2015 09:04:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=dev@mabe.berlin; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dev@mabe.berlin; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: dev@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:59473] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/10-61069-BA410755 for ; Thu, 04 Jun 2015 05:04:44 -0400 Received: from dslb-178-000-147-234.178.000.pools.vodafone-ip.de ([178.0.147.234] helo=[192.168.178.46]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1Z0R4q-0001xA-8X; Thu, 04 Jun 2015 11:04:40 +0200 Message-ID: <557014A7.3040207@mabe.berlin> Date: Thu, 04 Jun 2015 11:04:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;dev@mabe.berlin;1433408684;a799abd5; Subject: Re: [PHP-DEV] Migrating PHP classes to built in namespace From: dev@mabe.berlin (Marc Bennewitz) On 06/04/2015 10:01 AM, Yasuo Ohgaki wrote: > Hi all, > > On Thu, Jun 4, 2015 at 12:07 AM, Sara Golemon wrote: > >> On Wed, Jun 3, 2015 at 1:33 AM, Dominic Grostate >> wrote: >>> Has there been any discussion or consideration towards migrating or at >>> least aliasing all built in classes to a Php vendor namespace? >>> >> Not any that's led to a consensus. >> >> Personally, I like the idea of moving EVERYTHING to PHP\ at once and >> building in an automatic fallback, so an app could do: >> >> > $dt = new DateTime(...); // uses builtin DataTime via fallback to PHP >> namespace >> >> Or: >> >> > class DateTime { ... } >> $mydt = new DateTime(...); // Uses user supplied DateTime >> $pdt = new PHP\DateTime(...); // Uses builtin DateTime >> > It's acceptable option, but I prefer explicit declaration for clean root > namespace. > > >> Possibly paired with the ability to import a NS to root: >> >> > use PHP as \; >> $pdt = new DateTime(...); // Uses builtin DateTime from root namespace > > +1 for "as \" > It achieves both clean namespace and compatibility at the same time. > It opens door for easier API version up also. Automatic fallback disturbs > this. This one is not compatible with current code as you have to alias the PHP namespace to the root one before using full classes like \DateTime. PS: I like a lower case "php" much more than upper case "PHP" ;) > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net >