Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106549 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 92972 invoked from network); 12 Aug 2019 10:49:12 -0000 Received: from unknown (HELO mail-ot1-f50.google.com) (209.85.210.50) by pb1.pair.com with SMTP; 12 Aug 2019 10:49:12 -0000 Received: by mail-ot1-f50.google.com with SMTP id e12so11562856otp.10 for ; Mon, 12 Aug 2019 01:17:18 -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 :cc; bh=bdlq0ZVdAblHbN3AvWiDbyVvYtlTRCHspIkfNpZIldQ=; b=vIMbuwqzgpibFrXZxOG4pHuHW6PphQmZukAv5Ky82ePP0YjL4WTlu/g4ZEQ5sxCMu/ mKYTU3t2Jg4RLrAyRab7OHr8SVgixyrcLwG91SvmNN/g8S6c8vY5BB+hzOYrCMBXdhoZ gpmr0uiA2awOlSEwZ1XDDA/mWrNn/lQ3Q3KXb2VDHStiQqDWU8xYWMmtfdIlhJW/ipx6 qxFemzU4C8WDkaWFHm8wNHjA/nDYIOPyzY7vq1X7ZxkYUYipUNcSXqVTqE5oNslsYcZ2 fH8I31dltZWM4jm1K6iarUOhZiHo/Tk4hPFvgfbiKneD8A3FEuEYoZ30E1ZlhdIUzobw o7TA== 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:cc; bh=bdlq0ZVdAblHbN3AvWiDbyVvYtlTRCHspIkfNpZIldQ=; b=GiGYd+tzQd8HFssdLHSAQsmgpXiZcwnRVT7jRC+PCvJs3eW/XXihnXE9Ds07W+qNqh V5OYQhLluR9QIzLxrMLigoFC+TkKE+WK1VUBhOgYhxeVb3hmYvqCUxmbm3dWtxndkEje l2uagvPj5p5XYPE+i8n0PeMn+UuYHoKiADOgcQ24gleQlxFe8eVM8YS1i3NyXd2dD1o8 ACxQumbvxkGtr0T8+g4LdXU1cU2psdD6GByGqNRUVJAazBjoV8wsnOetnXfooYbrlvp4 +VXGt6nxUZLoKjyx7kilB9HGNs5kiJYuCrPA/7OV8frrnJhyhjbdz+r66oFgMwwf8jP8 MSfw== X-Gm-Message-State: APjAAAUDXwIaQcaWZ2v+OKYGKaLdQ3cBTUDuFNd8zseiDXyFsd2qQ4LV T25q+KLeRTkq2a/iTfcOttPTBsrRrZRmX7+RIQ0= X-Google-Smtp-Source: APXvYqzCUC+nztpgGfqLP96nQIVUriqaCwSUKOuXWGvpsBYryYUF//bhFcL5yDpdadO6JVrb+EmsAwwYJwFde+diRIk= X-Received: by 2002:a9d:1b02:: with SMTP id l2mr25933692otl.45.1565597838299; Mon, 12 Aug 2019 01:17:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 12 Aug 2019 10:17:05 +0200 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000035854058fe72721" Subject: Re: [PHP-DEV] [RFC] Namespace-scoped declares, again From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000035854058fe72721 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le lun. 11 d=C3=A9c. 2017 =C3=A0 14:44, Nikita Popov = a =C3=A9crit : > 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' =3D> 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 th= e > 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. W= e > can introduce a require_explicit_send_by_ref declare directive to make th= e > call-site annotation required, and libraries/projects can easily opt-in t= o > 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. > I've read discussions about the notion of a "package" and the way we should define its boundaries. What about the following? Individual files could declare their package using this style: