Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113141 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 92576 invoked from network); 11 Feb 2021 16:54:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Feb 2021 16:54:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5F36E1804D0 for ; Thu, 11 Feb 2021 08:39:36 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 ; Thu, 11 Feb 2021 08:39:35 -0800 (PST) Received: by mail-lf1-f44.google.com with SMTP id z11so1050533lfb.9 for ; Thu, 11 Feb 2021 08:39:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3sUJTGT1BdPSL1Ji6WOSN/BUQZgO+t2YXdyA3fKROXI=; b=N0sBXVEi+EAHf6VFIbsBBNCQvZBA16tmhUUkp4sMnYIGt403aWa2aEwC+g9Jg0VTEN iPl8l5mYq2xVgtsF79x0vyWdoq7T6URFxPoKdxc9LAx7VaF0kKX49ZSthtGEc4Os8m4a QJhdikxDlJvK2S1ekbnmYCOnTojNYzQCVNNefVk1SJii9k/gLWp94ISDVTnPrytxavr1 w1v+3EeMdSlhvB0YzXDCWSB484Xn4+sC+ifM1roln5FTjZM3Tnb3XULm/Kcub+xWCjD7 Qm13W3DamK7mdd5G0r/u+BnbeQJ1F7N3tlaUwJMpo8FFWxK22CWSEk61PCbNt9lrFYBQ GE/Q== X-Gm-Message-State: AOAM532QuJ9HzxgTwoUtoANcdRMv/oqH1vWOlFdg/rdsoj49Z4q68r4+ WEafSJFEkq+Kb3l8VxyhAjHG78y90n6aUQmAWLzRUuLa5eg= X-Google-Smtp-Source: ABdhPJyIItpjWvcRL9rOWKD0YwEbrWyzWkUGPDu4w4LEVk5ajqRpyb6PUfNkMK9wx/rR4FYDs0IBZK2Norahbr4cP2Y= X-Received: by 2002:ac2:4ec3:: with SMTP id p3mr4709519lfr.597.1613061572342; Thu, 11 Feb 2021 08:39:32 -0800 (PST) MIME-Version: 1.0 Date: Thu, 11 Feb 2021 09:39:16 -0700 Message-ID: To: internals Content-Type: text/plain; charset="UTF-8" Subject: Proposal: namespace the SPL From: levim@php.net (Levi Morrison) Hello, everyone, There has been a lot of disagreement about namespacing, and people seem to have different viewpoints. I am not sure how to reconcile this broader discussion. However, there are certain names in the global namespace which I am hopeful we can revolve. For instance, `SplObserver`, `SplQueue`, `SplFixedArray`, etc all follow the `Spl` prefix. There is already an established "namespace" for these names. So here is my limited proposal: 1. We create names in the `Spl` namespace that are aliases to their equivalent types with the `Spl` prefix: `Spl\FixedArray` -> SplFixedArray `Spl\Queue` -> SplQueue a. The new names are the aliases so any code which uses `get_class($obj)` will not have the name change on them in a minor release (8.1). b. We may switch the direction of this alias in 9.0. 2. Any new types going into `ext/spl` use the `Spl` namespace. New types added to `ext/spl` should be either related to data structures or iterators, which is the bulk of what the SPL is. a. This rule is to help prevent the SPL from becoming the dumping grounds for new types. 3. We leave functions alone for now. Let me know what you think. I am hopeful this approach will work because: 1. It is focused on a specific area which already has an established "namespace", but in name-only (not technically). 2. It does not try to solve the larger problem, which has a lot of disagreement. 3. I will be proposing new types for ext/spl soon (`ReverseIterator` and an array iterator that is more efficient than `\ArrayIterator`), and Tyson Andre has already proposed `CachedIterable` and company which is in `ext/spl`, so this space has active development. Thank you for your time.