Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109836 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71606 invoked from network); 25 Apr 2020 00:28:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2020 00:28:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7F0FE1804CB for ; Fri, 24 Apr 2020 16:00:50 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 24 Apr 2020 16:00:46 -0700 (PDT) Received: by mail-yb1-f174.google.com with SMTP id p7so3788708ybo.12 for ; Fri, 24 Apr 2020 16:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=doUgKP2ToM2WT+2Ez/2yMKIx60iruB9vxE1012CXjbM=; b=nHD7/SQQutPsmDD5K6N3wV9YAsMIh7sOrIbwP2pzElf/Idb92bA2Yr/GKg/Nom/rtn QPVgrmKiu8r9s5R0QG+P6Zq1QyO5eG4JbnNgqoFMIm3wIMbHXEEO5+4NNwyGIsMH/uxL MXtAtBYC48uqJn4nrdydHeOrMu0zUgvL4/bAkZDpxE73mmO6xVKeGsoYtT1/jb7AVDjY z0fFXWJSNRlBeD2pQx1Sh2uhEk3XLWEqQrDPQC1o45SrnTc6Pies3ZyIQFEKnLq1sU3a hWZRQQjHuBnhC1ttgfCRy2tzTFKkWHixyyDKlIGHXU/8+cNHfWt81xZoaOGOut99jQoA EbCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=doUgKP2ToM2WT+2Ez/2yMKIx60iruB9vxE1012CXjbM=; b=tZ0Q5bY2N/Fo8gpHMJpTQVvC6cyDJKs5yloa+rmO3LTUl2tIkMoWjDv+b8Mz5ejMKu 58azNvmJ0zxTj98Jsu9mscs7OqFAdm6e4DV3A+kClRGhq8/Hx8gl4nckDO9UKj8SCEXH K2Ra7snBSWI0IMcv63ACLumW4GRtKWNEx/am98YvHIBbGIaAh29z8zOTWFVI/+eRhhAB BaRCLfYxCKSeBFGLbQH9H27Jrhot+g0k37QplKk7sh4UnCdCKUDRonqRj1oLcHQnQT10 HAVp0l/42AMwn+vKO7Pl8rVMNbzSFIJoykMNvkgUdh2d/BuKR5mMtgFf50JP0quUTo2y wUUA== X-Gm-Message-State: AGi0PuYhYYPkKthu6b9PQ6VIQr39f4xUe8h40sT7ef02gKjwNFNG9nKW W3Pg/vHf9bqAbd8U/ibbMUjwFvrshQaIOOhri6fity9iOSg= X-Google-Smtp-Source: APiQypJ2b4/soLNTZYtXbd3yfQHWVR7eaPxIH5n7sXYdEdRM1nIPyjBcFqA3DTzx0TA3TdbMrY1HIcf83e8U7PJcIVo= X-Received: by 2002:a25:3f41:: with SMTP id m62mr17770862yba.455.1587769244798; Fri, 24 Apr 2020 16:00:44 -0700 (PDT) MIME-Version: 1.0 References: <5ea1aab8.1c69fb81.72671.791bSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <5ea1aab8.1c69fb81.72671.791bSMTPIN_ADDED_MISSING@mx.google.com> Date: Fri, 24 Apr 2020 18:00:32 -0500 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000d2537c05a411557d" Subject: Re: [PHP-DEV] Re: [RFC] PHP Namespace Policy From: tendoaki@gmail.com (Michael Morris) --000000000000d2537c05a411557d Content-Type: text/plain; charset="UTF-8" On Thu, Apr 23, 2020 at 9:48 AM Mark Randall wrote: > On 15/04/2020 12:21, Mark Randall wrote: > > https://wiki.php.net/rfc/php_namespace_policy > > Just an update in light of the two different RFCs. > > Having chatted with the other RFC authors in R11, rather than racing to > see who can get their RFC to vote first, it seems like there's room for > both. > > Vote 1 would be the other RFC which would be something along the lines of: > > "Mandate the use of \PHP for future internal tightly-bound components" > > If vote 1 were passed, the next vote would be on this RFC, and would > cover policy on namespace usage and would be something like: > > "The \PHP namespace must remain empty, except for child namespaces". > > This would be to prevent the problem of colliding internals symbols > throughout the rest of PHP's maintained lifespan (such as what if there > was something else added to core called Token). > > Vote 3 would mandate only autoloadable classes / interfaces / traits etc > etc were used, allowing userland polyfills (where sensible) to provide a > route for users to begin using newer API functionality without an > immediate upgrade. > > Votes 1 and 2 passing would put us on a pretty good course for long-term > sanity. > > Vote 1 passing and 2 failing would result in part of the problem just > being moved to \PHP and exposing us to symbol collision further down the > line. > > If vote 1 failed, we would have to consider if this RFC would pass with > its tigher constraints. > > The question is, how would we vote on extra uses for PHP. > > While the alternative RFC mandates its use for tightly coupled, I think > it makes a lot of sense to add extra things to it, such as re-designed > collections (borg Ds?) in \PHP\Collections in a similar fashion to: > > > https://docs.microsoft.com/en-us/dotnet/api/system.collections?view=netframework-4.8 > > > Mark Randall > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > I would like to submit from the peanut gallery of user land. My perspective here is as a user, not as an internals writer. I also have no formal training so I can bring that perspective to the table for consideration. That said, I don't represent anyone but myself. I've read the talk of how the \PHP namespace should be used and not be used. I personally think we should slow down and carefully consider what we can do here, because active assignment of the namespace will have ramifications for the rest of PHP's life. We have the opportunity to make a course change, but it won't be easy. And we only really get one good shot at this. All of PHP's core functionality is currently in \. All of it. That makes the language easy to pick up and learn, but the functions in that namespace are, well, idiosyncratic. Are the arguments in (haystack, needle) order or (needle, haystack). Is the function camelCase or underscore_delimited or neitherone? Changing function names and argument orders would lead to BC breaks so massive people would move away without a transition plan that was sustainable long term. Namespaces give that opportunity, I think. So, in steps: 1. Take the current function roster - all of it - and put it in \PHP\Legacy\. So the formal name of strpos would become \PHP\Legacy\strpos. 2. The root namespace would be empty BUT... 3. An INI directive set globally or per directory can set which namespace is bound to root. Initially this would be "\PHP\Legacy", so all legacy code would not have to change - it would run in the new version and find all of its functionality without incident. This is critical - as this directive would likely need to stay as is for two majors minimum, possibly more. And yes, I'm keenly aware of the scope of this. The RFC system itself would need to be changed to allow this to be possible since this approach demands a design be submitted, approved and THEN an implementation written and approved. Difficult, but not impossible - the W3C does this all the time. Even with a Design, then implement RFC system in place, I imagine a full year would be needed just to get the designs down and agreed upon. The best PHP 8 could do is just lay the foundation for transition outlined above and not actually include any alternative to \PHP\Legacy The rest of \PHP\ would be the replacements for the legacy pieces. It needs to be a designed library with a consistent naming schema and argument orders, at a minimum. It also needs to be broken up so as not to overwhelm the developers doing the implementation. We might even end up with some duplication to satisfy the procedural vs. object oriented camps. The new functions would also have a freer hand since they are opted into. Beyond that though I don't really think it's helpful for me to go into more detail because I'm not a language designer. I know enough to know I don't know enough to give this subject a thorough vetting at this time (I could certainly learn). The specifics of implementation though are out of scope - what is in scope is the mechanism of transition. We have a golden opportunity here. I guess what I'm asking is, where do we want to go with this? If we aren't doing something with the legacy functions as part of this I feel it's just another layer of confusion and frustration for end users like me. There has to be a clear rhyme and reason to be putting things into the \PHP\ namespace. Again, since there's nothing there right now we get one shot at this. Once things start going in there they'll have to be supported in perpetuity. So let's think very, very carefully, about what goes in and how - please. --000000000000d2537c05a411557d--