Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101323 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56502 invoked from network); 11 Dec 2017 13:43:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2017 13:43:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.43 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.43 mail-it0-f43.google.com Received: from [209.85.214.43] ([209.85.214.43:35263] helo=mail-it0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/1D-53433-19B8E2A5 for ; Mon, 11 Dec 2017 08:43:45 -0500 Received: by mail-it0-f43.google.com with SMTP id f143so15849753itb.0 for ; Mon, 11 Dec 2017 05:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=hROlrlOmwx6ESDp1cUWv+cJLB8LJMUQDEsF2IH6PRKY=; b=ZdqcUJDbUteNtyyP2r/HeT1JEVI5axlcIHI1vK7nuegho6Gg8I9LNu5/i9GAExSz75 AUQRT7k4MFVGzNmhvt8YYU0AIk0rq2UM/JtOaEbYOkJHsaWgyxsweVH/n5YSmMRQ8t4E BcHcqyCCCgGuJdQZ9VuytpsMHqZZVmDKez2GubWJ3E2b9BCKiaxQb/vNVAUf8zxAX3Z9 gTbkztO4e6ddyn+oqNw9fHOl8xISqLcSqyUJjlDnd7DGtQ6NA2F5dcEsxLBI1QfEdPeq nkfRC4dykC9XXSVxMYif38mVP+uZfnK+wn+SLjwHchZBPRvcN2+RbS+Lncuj8fagbLon hcBA== 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=hROlrlOmwx6ESDp1cUWv+cJLB8LJMUQDEsF2IH6PRKY=; b=pLxE2IhhAsr4JdTx/at5kQGEDRe3+NX4S/EsSfxQe2KAFaVpBDOqKbuoOOOb7WTZG9 mmHnTlp03ov+vzgDLDtLRluI5ZFfr4RFaoEu1/J1T88BhxrCitrSEzRmAvlRsTfOMJKY 7FbN2lVOUCbNtVhAA2LXyxUE3lgedqIhly8f2DC/Cgj5YYU4QEXyWKm36nWBohubR15D u1ymbitv9C7VUowz/4l2ZT9TPLkTyNAHmf2zFaVdDWS626s9Dh6cPejNo6zhcBeb8f+N SaCVq6ZRPnHYPvWTWLY0lzksD9q1kNr16AhEiU+UmOdnLMf6N5jxQ+coHaMHUx6BYt9b my7g== X-Gm-Message-State: AKGB3mLfa4cCe0YOr4spupn+Wnt4wM/hzDqN/efy19XZjOUcNdbPDmS2 13HEe+DiIEzbEsuiIG4xSxXveNGB9CbGayIQANl+nQ== X-Google-Smtp-Source: ACJfBovOWx1aRqQlrPetuaSscyV9yB196IWyLozbTfDsT9OMrCJ4fTvqDgpQffUxFcM2BkSA/YxGVTZqGRgWJuVoISI= X-Received: by 10.36.67.199 with SMTP id s190mr1067706itb.153.1512999822459; Mon, 11 Dec 2017 05:43:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.93 with HTTP; Mon, 11 Dec 2017 05:43:41 -0800 (PST) Date: Mon, 11 Dec 2017 14:43:41 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="001a113faebcf6859c056010b88e" Subject: [RFC] Namespace-scoped declares, again From: nikita.ppv@gmail.com (Nikita Popov) --001a113faebcf6859c056010b88e Content-Type: text/plain; charset="UTF-8" Hi internals! Some time ago I introduced the following proposal for namespace-scoped declares: https://wiki.php.net/rfc/namespace_scoped_declares The idea is to allow specifying declare directives for a whole library or project using: namespace_declare('Vendor\Lib', ['strict_types' => 1]); I've finally gotten around to implementing this proposal ( https://github.com/php/php-src/pull/2972) and would like to move forward with it. The reason why I'm picking it up again is some feedback I received for the explicit call-time send-by-ref proposal. The main objection seems to be that the feature has limited usefulness if it's optional rather than required, because you still can't be sure that something is a by-value pass, just because no & is present. At the same time, we can't make this required anytime soon due to the large BC impact. Namespace-scoped declares are perfectly suited to resolve this problem. We can introduce a require_explicit_send_by_ref declare directive to make the call-site annotation required, and libraries/projects can easily opt-in to it using namespace_declare(). There would be no BC impact, while at the same time projects could benefit from the additional clarity and performance improvements immediately. Thanks, Nikita --001a113faebcf6859c056010b88e--