Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86709 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89442 invoked from network); 16 Jun 2015 11:23:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jun 2015 11:23:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=codekestrel@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=codekestrel@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.212.180 as permitted sender) X-PHP-List-Original-Sender: codekestrel@googlemail.com X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:38106] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/61-14163-02700855 for ; Tue, 16 Jun 2015 07:23:12 -0400 Received: by wibdq8 with SMTP id dq8so16151261wib.1 for ; Tue, 16 Jun 2015 04:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=LU+SEgKYXLUtTNgCz+XPnNVIlrKxgvxn8ktwjHlaJfU=; b=mXe3dAgUqDIryiBHAO2UqWCF8TGbsmmZBVamESOLG80me9tnoGJbUwaCkZS4Hc4Kgi 4vesfgQCM/eQBKGlHVVZbL22zew1+sDfDA7+/QrYbeoDxuFmiud2/VtSRcSH2kA9g7Lo f4DBrLSazi2QupDz+SP3jkXivqy1Jc/l1apMAJTnKovO1WCCGQhVQqkr3fy4Oig2FQ9t IKDncviahoM2gBE7oCljPRStfDxwI/VRlsUzQyh4IKmbr7JqHkxKf4tHwd7wJL+tj9+1 unHNxLpyaiJw5Xzb/IDuPkyB7wMf4BokCavxRKxXT1NZr3QsngOeTlfVj9ZlTJS6NSu/ nbBw== MIME-Version: 1.0 X-Received: by 10.180.75.8 with SMTP id y8mr5725290wiv.31.1434453789590; Tue, 16 Jun 2015 04:23:09 -0700 (PDT) Received: by 10.27.214.20 with HTTP; Tue, 16 Jun 2015 04:23:09 -0700 (PDT) Received: by 10.27.214.20 with HTTP; Tue, 16 Jun 2015 04:23:09 -0700 (PDT) In-Reply-To: References: Date: Tue, 16 Jun 2015 12:23:09 +0100 Message-ID: To: Yasuo Ohgaki Cc: internals@lists.php.net, Sara Golemon Content-Type: multipart/alternative; boundary=f46d043c7b9c934b3b0518a0cccf Subject: Re: [PHP-DEV] Migrating PHP classes to built in namespace From: codekestrel@googlemail.com (Dominic Grostate) --f46d043c7b9c934b3b0518a0cccf Content-Type: text/plain; charset=UTF-8 I've missed out on most of this discussion via email, bit I've watching the threads anyway. It seems to me the main debate is about backwards compatibility, and where the classes belong. My reason for starting this thread was not really out of necessity, but merely to argue semantics. So if it is not worth it then it is not worth it. However, given that some people here appear receptive to the idea I'd like to support my original suggestion of aliasing by comparing the concept to JavaScript, where by the root namespace is an alias of the window object (or vice versa). It could be used as a permanent alias, or only as a solution for phasing out the global namespace in preparation for PHP8 in X number of years. On 4 Jun 2015 9:02 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. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > --f46d043c7b9c934b3b0518a0cccf--