Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101331 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5814 invoked from network); 12 Dec 2017 07:46:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2017 07:46:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.49 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 74.125.83.49 mail-pg0-f49.google.com Received: from [74.125.83.49] ([74.125.83.49:33769] helo=mail-pg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/D1-53433-0498F2A5 for ; Tue, 12 Dec 2017 02:46:09 -0500 Received: by mail-pg0-f49.google.com with SMTP id g7so12895909pgs.0 for ; Mon, 11 Dec 2017 23:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=oilCmgZkgP8YNs1w14u+HDk13UD1giBK2EJDNOrt5iA=; b=aMv6jK7efjjvi8m6XGvOVtYO2D2YxqQaMfygghPpyXNKY651Ljslm2m2k4/ks8Vt97 Hig06gYRjD8xWhqKBQtQy1fkmiHGr5lq1IH83Co4szjwPkPHfdqmfewIDGZZoQ8ITOgP DTTXARUcm7n+2tZkdwW5ToXz7PhGALDwkIQH5H2Hn3E9KfOyn4nlvmf9Vb6jbkwYJkdN h1HQSCMfwc1H7QkhY++/0OlBNFHZfcmJT85T4Y5MYXJuVNsOFBm33eyGc7OmV2kLy9EX AayN+bbJXQ+ZnAnWbz7kDwwHLQmF7NB0PSsRX7fvuuElBbWBxnczsaHTz1Rem1hexlMv YqxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oilCmgZkgP8YNs1w14u+HDk13UD1giBK2EJDNOrt5iA=; b=iliIeKz7DjA9Hur43dCqYOExaGvfl8RvwyNuSYqJ5uFq+BV5dLrx7FH6bds26rVNoa 0dfLgPKQ1DsSWUJncCdkgdIYx5HeaC7w1GIWPPjqIymlgWmMzAYcuzcfLiPp1b8psLxU zBzSkkNRw8w3O5lsxJquIDO++ZDfarFVDeBPdYvRzRx+mTOs3riTsEFE3EzSAWWInmis FYQAk1oLXQ0I8ls/7dqJhGjmKk7TOeDJymvOq3uWdnGlJ/TEZNt5aAahaEsehgSxN8Cv QBs1H77K0IQU3lzd7B8LnDNjMHGb7n2+E9ayAE+ZgYwr+hpBrdpAP/UvzaXMGK7pdl0y BfOQ== X-Gm-Message-State: AKGB3mIwpgAZzT+9K/HJSv3KqEJaZc2fUCdZfy5+4keOfuWLxTl1Vzxt mVboK3F6AEJ1eA1KOoAfpdA6xMc= X-Google-Smtp-Source: ACJfBotIoPXkYwFjkqGpWjCrAu5rCTDLwtEIyMk0YwBGf+DWPmL5h+3x37PC+/5FHtmS03I+ZVF1Fg== X-Received: by 10.84.217.86 with SMTP id e22mr1382989plj.283.1513064765064; Mon, 11 Dec 2017 23:46:05 -0800 (PST) Received: from Stas-Pro-2016.local (c-73-71-144-171.hsd1.ca.comcast.net. [73.71.144.171]) by smtp.gmail.com with ESMTPSA id v28sm29701985pfl.118.2017.12.11.23.46.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 23:46:04 -0800 (PST) To: Nikita Popov , PHP internals References: Message-ID: Date: Mon, 11 Dec 2017 23:46:03 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Namespace-scoped declares, again From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > The idea is to allow specifying declare directives for a whole library or > project using: > > namespace_declare('Vendor\Lib', ['strict_types' => 1]); I am not sure I like this. Namespace is a prefix to a class name. Anybody can declare a class with any name, and the side-effect that they would inherit some context, which is completely invisible and would magically exist somewhere globally, does not seem like a good idea to me. Moreover, what if something - like older version of the same library or test or something like that - would have different idea about what that global state should be? How nice would it be if a piece of unrelated code could completely change how my code is interpreted? How nice would it be if whether it works or not would depend on in which order classes were loaded in this particular request? Hidden global context has the same smell as php.ini settings, and for the same reason - but this, as far as I can see, will also be hidden and depending on file loading order, class loading order, etc. which in big applications can lead to a lot of fun debugging why some code randomly produces fatal errors... Debugging PHP is fun enough without quantum entanglement-like effects :) > 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. Where "soon" means "for all practical purposes, forever, unless we stop calling that new thing PHP", IMO. > Namespace-scoped declares are perfectly suited to resolve this problem. We I don't think so. First of all, I don't think, of course, that this problem needs to be solved by adding more complexity to save a purely cosmetic feature. But second of all, I don't think global hidden context that could change at a distance how the code is interpreted is a good idea regardless of whether it solves the issues with send-by-ref. -- Stas Malyshev smalyshev@gmail.com