Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101390 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55752 invoked from network); 19 Dec 2017 20:18:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2017 20:18:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wm0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:41297] helo=mail-wm0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/A5-10479-A24793A5 for ; Tue, 19 Dec 2017 15:18:51 -0500 Received: by mail-wm0-f51.google.com with SMTP id g75so6105052wme.0 for ; Tue, 19 Dec 2017 12:18:50 -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-transfer-encoding:content-language; bh=495IZWFoGzXDI8+jBxJq0vEH1UZk0cdCrqXuG9O6vjs=; b=BnY1xAhg9zeD1zYo08bSG3DviYntRBOvCYkHPzg7XBptpmHAiAp2Otgw7Z8S6u6QDc aiVCXcjv8P1msDDdMx9ZWMGQIk9jYN74Wtl+tHqGT6xqz9mdCvvEO3nhFMZwI6fo/WDV bz5eiqHoSWRh1aTlURinmvt2loVbWFrQW94/loJcZe+Q+PNqStwIMEf9c4MKghWmu5ss OPgTRX9sgVNZtKfhygWxNGFgMFMy4nunuUnLV9F7UC4BVk//T9G74Luo4qkUWGdrCfbw 7k8te8Qvq42PUJ9cYfvXoy+K9sxzrv3Ts6xlgBsFtxXzuVQs/XauY4KS3GwA06dV8rNB E/qA== 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-transfer-encoding :content-language; bh=495IZWFoGzXDI8+jBxJq0vEH1UZk0cdCrqXuG9O6vjs=; b=ZpcPLrKi69MREmC6TWDBEUpnDO1yFT8igOFAd5DfMQym+ZCBTJTgu7YcTE0VXLoVad fwKB6uNP3PhgRhzhG1r4f9TJ2NmnaYEcsWDJd5fvKSWE4BO/Iw6y0PiiGqFdXHsfz5YS 0EGp/PgnPBpQ2waqsFV5jTtfB0PC5h0D5DZ6qBKG/wIPQMq+l5LAVMD+uF2vrEyyaYXs 96ePltJj1m8r8Fv5TObJDwz9SGm9yPWHBq6ATgbBGenxSJoDjuQLm3KLnezoyRI48UTQ 3siHz26GTaHOQiY4GIMWEAmlpzpCDn24uCZDj028dho3wZ2sSdT9THHywutyE+hd4AG3 9Iog== X-Gm-Message-State: AKGB3mK16n8Hl1vQepN8sGbTPmtiV4cZRMzKBFdDUtK1V5m4KUOGztAG 0iFPcrj8rRwkhKRYEvk0JKUAUA== X-Google-Smtp-Source: ACJfBovAArg+aeIv+ZQku1jLrlbPs1LH3XWUznWkViFAL86PmSsfF1bz23JgHs5iuWpOXU705sK0FQ== X-Received: by 10.28.210.8 with SMTP id j8mr4503947wmg.159.1513714727547; Tue, 19 Dec 2017 12:18:47 -0800 (PST) Received: from ?IPv6:2a00:23c4:4b81:ae00:593:e8c1:646b:ac1e? ([2a00:23c4:4b81:ae00:593:e8c1:646b:ac1e]) by smtp.googlemail.com with ESMTPSA id i65sm6701528wme.20.2017.12.19.12.18.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Dec 2017 12:18:46 -0800 (PST) To: internals@lists.php.net References: Message-ID: <8d43790d-4989-30d7-be48-10599fddf6cd@gmail.com> Date: Sat, 16 Dec 2017 23:18:48 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Namespace-scoped declares, again From: rowan.collins@gmail.com (Rowan Collins) On 13/12/2017 07:12, MichaƂ Brzuchalski wrote: > Andreas, we're touching namespaces which is a hard subject, but if I could > fly away with my thoughts > I'd propose to introduce something called for eg. a package My thoughts were actually going along the same lines: basically, the current implementation of namespaces is, I think by design, very conservative in what a namespace represents. A namespace doesn't have any identity, and doesn't have any codified structure, it's just a shorthand for referring to similarly named classes (plus functions and constants). There are several things that I think would feel more natural with "packages" than namespaces as they exist today: - Declare directives, as discussed here - Visibility modifiers, e.g. a "private class", accessible only within its package - Per-package autoloaders, that only get called for classes in that package, rather than a global autoloader which parses out the prefixes it's interested in - An autoloader callback that fires once for each package, to setup these options Another difference is that namespaces tend to form deep hierarchies, but you're unlikely to set options at every level of the hierarchy. For instance, you probably don't want to set strict_types on for Acme\MyPackage\Input but off for Acme\MyPackage\Output. So a separate syntax to mark which level is the "package" would reduce the number of places a setting could be set, which would reduce the number of places you'd need to look - a bit like having Apache settings in a VirtualHost for the whole site, rather than .htaccess files in every directory. All that being said, I'm not 100% convinced this is solving a real problem. Yes, the option has to be set in every file, but that's because it effects the way that file is compiled, and the compiler sees one file at a time. The same applies to the "namespace" directive, which you might otherwise set against a particular directory. I don't see a pressing need to add the complexity. Regards, -- Rowan Collins [IMSoP]