Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98233 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23855 invoked from network); 7 Feb 2017 09:51:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2017 09:51:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.220.173 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.220.173 mail-qk0-f173.google.com Received: from [209.85.220.173] ([209.85.220.173:35458] helo=mail-qk0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/A5-03389-49899985 for ; Tue, 07 Feb 2017 04:51:17 -0500 Received: by mail-qk0-f173.google.com with SMTP id u25so82172220qki.2 for ; Tue, 07 Feb 2017 01:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7Jraq4ifVZVv1JszBoojSa43I6DUKA4UFqi8Uk6ABQs=; b=DANBlaC8tCmMnCPX0ZQMZx+yJ2Ww3NcmJE087u7ZUEm+D8hE5odCPMo6aL8I+UnTpm 623gy7x0VE5wcnrc0sWh4dK1Me9g/SW1dkE9i4ZvNI9SBneDh3MiFzf4wAMCBdkBIgFR qUdHDH01fuZDkNPhh5VNpw1BQsbdECLuWr4Kjfv2c6t9gf8Ai4nAJUHNrr/0qFxazLIw NJ97782ID9RfYmIsYpjcIgDavHtjBA6U8XdUnpxAOw/2cDMKOCykE4f137aX/UPgUt9x ggReemyzayzfs8Zb5SEMdGmXLdwIjHkep0XA6m0RJWvoIXMRm6gVrAaPcaH7lEXbeCIp WFuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7Jraq4ifVZVv1JszBoojSa43I6DUKA4UFqi8Uk6ABQs=; b=V35/ti5uQ4kwHM+M1Pskls7PnbJAOJRRvQTgGSQQBpPxZk9/0e8rOClIZN30E0JVnA 8NV4y02FtJgf3NGETahQGXwdcPrlhj7WrbdHeTmEQ+U3b6S9FjNInIgOZ1CfUMFF2h+j 9ZX5x7B2fNr2QgoEdg4xroUYgBTTUmKCk7bY2NQA66ySvHTl4kcgc9qNyOLuR1B7E1Zh XgiBcjYade3LpnXSjcy7kPzUH/cPOsSpugThjrVE0ws7fAkBjtSQif+i/bAroaGEEa86 M07+f6P1yvQ8WKbKI6xOcky/aiNGFo1pnDQ217Cyd2W37zAFl27ubJJXv+mo10m93xbj 7wGg== X-Gm-Message-State: AMke39lWilaThnvpVO/I3boOzoGEFz8UxQuXu7bqHDH3BNbLB84b/L9NhFQuE/f0sOGSNEV3UYAUVl1gJfnxsA== X-Received: by 10.55.165.67 with SMTP id o64mr12710698qke.124.1486461073780; Tue, 07 Feb 2017 01:51:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.47.231 with HTTP; Tue, 7 Feb 2017 01:51:12 -0800 (PST) In-Reply-To: References: <459c6bef-8936-634a-9520-dbd65c35b7c7@fleshgrinder.com> Date: Tue, 7 Feb 2017 10:51:12 +0100 Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114f9f7a46a2a00547edb0fb Subject: Re: [PHP-DEV] Namespaces in Core From: rasmus@mindplay.dk (Rasmus Schultz) --001a114f9f7a46a2a00547edb0fb Content-Type: text/plain; charset=UTF-8 Just my two cents, but moving and aliasing core PHP classes/interfaces/functions sounds like an absolutely horrible idea. My biggest question is WHY would you do that? Writing user-space code today that uses the global namespace would be considered extremely bad practice - no one should do that. If you move everything from the root namespace into new namespaces, what will that accomplish? You'll have an empty root namespace. But for what? If nobody else is using the root namespace for anything, how is it problematic for the language itself to do that? Besides, it'll be a decade before you can actually remove the root namespace aliases. I don't see the point of changing this, at all. It will lead to inconsistent code and a lot of meaningless overhead for developers - who, ultimately, stand to gain nothing from this change. On Mon, Feb 6, 2017 at 9:27 PM, Sara Golemon wrote: > On Mon, Feb 6, 2017 at 12:21 PM, Fleshgrinder > wrote: > > First: I like namespaces in Core but here me out! > > > > The PHP (case does not matter) would be the proper vendor name to put > > Core stuff in, as far as I remember it is also reserved for PHP > > functionality. There were also numerous discussions about providing a > > cleaned up API there while maintaining backwards compatibility via > > aliases and so forth in the non-namespaced Core stuff. > > > I've been having this same thought lately since looking at the sodium > RFC. Here are my thoughts, centered on the goal of having classes > (and maybe functions?) in a \php\{extname}\ namespace hierarchy. > > New classes within 7.2 (e.g. \HashContext) to be moved without concern > for BC (e.g. \php\Hash\HashContext) > > Older classes (e.g. \RecursiveIteratorIterator) to be moved AND > ALIASED FOR BC (e.g. \php\SPL\Iterator\RecursiveIteratorIterator) > > "Aliasing" could be potentially accomplished in a few ways: > 1. Literally just class_alias(). Put another copy of the > zend_class_entry into the EG(class_table) under a different name. > 2. "Auto-use": Compile-time analysis of classname: "Is it in this list > of BC classes? Implicitly map it." > 3. ...? > > I like #2 because we can raise compile-time deprecation warnings and > we don't introduce any runtime overhead for most cases. > > Obviously, no removal of support for non-namespaced names until AT LEAST > PHP 8.0 > > This two big unanswered questions for me before I'd put this into an RFC > are: > 1. How to achieve BC in the best way > 2. What to do about functions/constants? Instinct says move 'em just > like classes. > > -Sara > > P.S. - wrt libsodium, I think THIS issue is enough for me to come down > on the side of voting non-namespaced to avoid it being an odd-duck. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a114f9f7a46a2a00547edb0fb--