Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101798 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7220 invoked from network); 7 Feb 2018 14:02:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2018 14:02:39 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:53277] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/7C-49805-EF60B7A5 for ; Wed, 07 Feb 2018 09:02:38 -0500 Received: by mail-wm0-f47.google.com with SMTP id t74so3360008wme.3 for ; Wed, 07 Feb 2018 06:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=fpruzGql+dIvKXmKBt5P+SOGkaLqDAkSVFBWntrLafY=; b=KC9TmGTopBoDiQB83Xu7H1XNufu8BsPRqM3B1HAjDSNqv7TPcbzVjNl/1Q7A0iwDn7 JBdmvL481GviIWdXnHe7gH9DcRnp1sOp10voP9Zd2xdq36aJCHfhn4kzWQGslIoiOoKt lXVzLeamzUc+Ct7xNY228qO/g7+vx9hJVeiHmFqTkMH7rcn+IA356X0EnbdvuTajmvKD sU9cyCNpx6AvKBcYacVhRpIRFqQ2itl5+vzbJHV4Lp2bzUoL5CIL791hhJuUzRNDd3er 90bMBg/8IApRuNL1JldZHeWhjAaP9frJNdloT3hZ6jHZPG9Ytqt4bSRZHNhyWR0+aMOO yfDQ== 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; bh=fpruzGql+dIvKXmKBt5P+SOGkaLqDAkSVFBWntrLafY=; b=oneTqKx7X0BP35nR2DZt/WSPLEFChpI7e1OdnhkVSbqwCglHo63wUdQRRBfiKr4jrP DusMkke/cZztH1a/r1T4NN4lV7SpZd0LFrGgZrxlg4KtBK9DPnCJjYavv2X3Uaw5b80O 46EuZFQ4n8sTRO/myDNUDGvL0LD7Fzuvbw/8WN25SD9+cb+Qlg3vKlevqS0oBDxSTzcm u3WBJ8Jm16GgqlO2oNhgb/yiiiI3DzrFs+IdP2apZ4SgT5EWE7dAuqJTtZYF1Kz4xGvz NX14Fw9E+t0PjFVyQrBP7tVFNR68pZiCTbMnUkGZBfp/wJ8hh3QyB0l4tGTh9v1I4kD4 NFvg== X-Gm-Message-State: APf1xPD+mU9un8+b/zUhvcOMd7RkWc60lBWnAbj4y1POpQo195mCxF0s 2TcDa8ulbG8VSGps9a5BGKGCX7FV9agO1JtWCaw= X-Google-Smtp-Source: AH8x225y1RrlgcNbxRrr4dgSBpNQ4JfZylwyG35HUpCt42zFoGvginxm8taLf3B6w7eR1EhO0HLTQzlD/zcpBFqvNF0= X-Received: by 10.80.145.215 with SMTP id h23mr8542948eda.86.1518012155172; Wed, 07 Feb 2018 06:02:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.222.195 with HTTP; Wed, 7 Feb 2018 06:02:34 -0800 (PST) In-Reply-To: References: Date: Wed, 7 Feb 2018 14:02:34 +0000 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="f403045c143e461af805649fbfe4" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Deprecation of fallback to root scope From: rowan.collins@gmail.com (Rowan Collins) --f403045c143e461af805649fbfe4 Content-Type: text/plain; charset="UTF-8" On 3 February 2018 08:27:18 GMT+00:00, Wes wrote: >Hello PHPeople. I just published the RFC "Deprecation of fallback to >root >scope". > >https://wiki.php.net/rfc/fallback-to-root-scope-deprecation Given the discussion so far, how about taking the "opposite" approach: deprecate unprefixed reference to functions which *are* in the current namespace. Proposal: - PHP 7.3: Add syntax to explicitly reference functions and constants in the current namespace, such as .\foo or this\foo - PHP 7.4: Raise E_DEPRECATED whenever an unprefixed function/constant resolves to something in the current namespace (other than via "use" alias) - PHP 8.0: Make all unprefixed functions/constants always refer to the root namespace Pros: - Much less disruptive change, as the majority of unprefixed function calls are to global functions, and would not need to change. - Both cases can be made unambiguous if the author wants to. - Apparently OpCache currently mitigates the performance hit by caching lookups in a technically unclean way. Users hit by this can make their code unambiguous in 7.3, and the optimisation will become clean in 8.0. - Function / constant autoloading can be added in 7.x if we accept the caveat that unprefixed functions will not be autoloaded; or in 8.0 if we want to cover everything. Cons: - Slightly uglier syntax. - Still a breaking change (in 8.0). - Class names will still be resolved differently from function and constant names. - Code actively using the fallback system (e.g. tests masking global functions with mocks) will need refactoring as there is no way to opt into the old behaviour. - The .\foo() syntax may appear in similar places to the . concatenation operator. Even if technically unambiguous and implementable in the parser, this may be confusing to users. A keyword approach like this\foo() would be clearer, but more verbose. What do people think? Is it worth expanding this out into an alternative RFC? Regards, -- Rowan Collins [IMSoP] --f403045c143e461af805649fbfe4--