Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101800 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15675 invoked from network); 7 Feb 2018 16:26:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2018 16:26:40 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:40810] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/9D-49805-DB82B7A5 for ; Wed, 07 Feb 2018 11:26:37 -0500 Received: by mail-wm0-f41.google.com with SMTP id v123so4451655wmd.5 for ; Wed, 07 Feb 2018 08:26:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=bjse6AFM+4yu6hjVO+vm9pCjwUzal3PRHzLLOwbtjyE=; b=YcgOyUhUOpgJTX8d6IHKgLMO+XnWaYM/eXL19jqeYEzlHpRlTspDrRDbUCF06mQQrq U3gqLKaTbzJjCAixmioqIGe6aFE0PAC236xtx0E3bgwb/dGmPrCALxZ5aYk+Uvb7cHaH rv8n3IepmubwSoYtOC4vqKw8pDd0fXuuz43hG2AbsxKXbqk1lbBnyMH8i3UqvLBpIscd f+JNlDpnsti3P1Yb4HkFHoId1zYvfCkkWm/182Uochapr/yX4/DBAw1One1JBskINfgK o3ifgZ7/Vu2ovzRp+3mZ0zhQnoi+UfcovoCeSe+lAtPtXSAgsdEKloI/tdgPE9gEOCJg jjeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=bjse6AFM+4yu6hjVO+vm9pCjwUzal3PRHzLLOwbtjyE=; b=Y5wUpdztrhaBXuIIpq0wM3ja5W4Ww7dRwuByupXdiGtwrTnZtwA4fKHgDdMGyok3To ovHN7lsAiHCt6zUFuHe0jyXJt1uRoXZNi6ZZU/YhYvNEuOfpVUYxWV8lUI8M23RySxOg dTU5hYNsW+Pz9smRKt2XZ2sgKnZHRAiGjMZaqtJQUeRRXZCi0D03V1P1Fbv20WI1VoxA 3DOLxk934/pqtl0Ls9alPNrBHkWr8MLBlBEReHlkGHvpqS9NDAxqh3d+NujLttAwEiFS oF4sufkqyQGOLfXmHRu7Zcn+xfdvyuub74/vtK+Qo3R3KNqor/EovPyVKyaEDJmaPLDd v6KQ== X-Gm-Message-State: APf1xPDu7xYWRzOmo/Wxqo4L16FTI4ZykTInyS8LGEAMquvIQXmMCGUW Vu2Ul7TPCp22M09ErVKF1DHkfTEuBv6Oo4NVSZ8= X-Google-Smtp-Source: AH8x226P3zyekt9Me6Yl7TxCnm10JPJGHENeY7QMvjmPK2gsEEN4Hpfj8I8kNwc6z+x3e68wXeNEFM8zNz+Zi5zaMoU= X-Received: by 10.28.134.140 with SMTP id i134mr5836892wmd.57.1518020794058; Wed, 07 Feb 2018 08:26:34 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.28.56.3 with HTTP; Wed, 7 Feb 2018 08:26:33 -0800 (PST) In-Reply-To: References: Date: Wed, 7 Feb 2018 09:26:33 -0700 X-Google-Sender-Auth: O41ZLWvUi4NcNfRglveQlNWSN2Q Message-ID: To: Rowan Collins Cc: PHP Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Deprecation of fallback to root scope From: levim@php.net (Levi Morrison) On Wed, Feb 7, 2018 at 7:02 AM, Rowan Collins wrote: > 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] My opinion is that the result is both uglier and *even less consistent* with namespaced types. I'm glad you are at least thinking about alternative proposals but this is worse than both the original proposal and doing nothing.