Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106567 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6015 invoked from network); 13 Aug 2019 19:36:39 -0000 Received: from unknown (HELO mail-wr1-f47.google.com) (209.85.221.47) by pb1.pair.com with SMTP; 13 Aug 2019 19:36:39 -0000 Received: by mail-wr1-f47.google.com with SMTP id k2so22591325wrq.2 for ; Tue, 13 Aug 2019 10:05:05 -0700 (PDT) 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=XGJq1gBPkR6Qx/mTKChpH737WWP66b6YwtlwlaoCRqY=; b=nR6v3rCHMkBbVH2wzE9Vqa6y7M+7FRIOuakfoiYC+fxO6oK29Vnoz0xiZ20Ukz4TgH W5DP9bvgewKZz/Pu8eVqE2dWsnesHMIxRIkWD8CgOWiHsrS3Y9cHLbvnTEtklbWS0KeI eV/KgQGkIdrkFoR5SGjFt3XCVnzdpyt+nu7d+M73+vQXjUiRT/9H6r8wodciXoXR0I8F b5s2BvpfKLlGBkZ70Po5jrUbmb1nOfE8EjPtEw26jNaZUs2DFMAwK3TozrThjVkdQJNp mpidt5koBefsyCTyv41frEIonMD15ZyI7JMzWDQSc4VT70VlPqb9d0mX0YPIRmpWtSPC +u1g== 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=XGJq1gBPkR6Qx/mTKChpH737WWP66b6YwtlwlaoCRqY=; b=gE2Gnx1FQvAX6iEBv69m88ZHOxXy9k5/fx8jAM3Vc8FogZjmvTYj4XwQ83lpzZeF+S BucrwiaIAHYpnydBYIt2Ecslx0uTWSdrFLgT/Wm1DwUTWDvKC/tN7OpKKOE/pP7GQ7zf 4N70ZKvqp+IAFo+rzLXkVEA49jJ/Z72B/Pq2RUTEOfqgFJMXRqQ334xCMDiOmsnlRaDg JYAKSt41lzo6LYseywSGqxJQqqUu8c+wa90OMCEtYiZG8CQVUjP/UsBy0l9qxuMuNX/f ywlRc23tQxH7+u9pZzZDRjyYWoHi/fq1DfqXuJjMxK6+8lINR1fOzAFFrzMcftqneYqL FNBA== X-Gm-Message-State: APjAAAVps5q5RPJqWyW1tsNa6Es88igWiXzeeqUAg5FljN1tTHX68gvO U03KTbIM60HGJyZs+dfZg4fYLm9y X-Google-Smtp-Source: APXvYqz0NXiOQ+sT87fgbj0ZL8+j1TozkduDMytb4/Or3zlz4OMfiZPRUm9lzFXzBjqos4kGRK0zrA== X-Received: by 2002:adf:ea08:: with SMTP id q8mr32655806wrm.188.1565715904577; Tue, 13 Aug 2019 10:05:04 -0700 (PDT) Received: from [192.168.0.16] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id i18sm138584197wrp.91.2019.08.13.10.05.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Aug 2019 10:05:03 -0700 (PDT) To: internals@lists.php.net References: <25d774e8-183b-d39c-4ac4-81c1b7770229@gmail.com> <5d5298a5.1c69fb81.b4ed1.2d97SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: <3db68c5e-54d1-812f-bbf5-1b089cba1bff@gmail.com> Date: Tue, 13 Aug 2019 18:05:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <5d5298a5.1c69fb81.b4ed1.2d97SMTPIN_ADDED_MISSING@mx.google.com> 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/08/2019 12:01, Mark Randall wrote: > On 13/08/2019 10:02, Rowan Collins wrote: >> I really like this approach. It allows a package definition file to >> exist, without either the language or the header of each file having >> to define its location. > > # > # File: /lib/company/project1/a/b/MyClass.php > # > > >   declare_import(company[:label]); > >   namespace company/project1/a/b; > >   ... > > > # > # File: /lib/company/__nsmeta.php > # > > >   namespace company; > >   namespace_declare [:label] { >     strict_types=1; >     strict_operators=1; >     upgrade_errors_to_exceptions=E_ALL; >   } > >   final class __nsmeta { >     /* does nothing except be findable by the autoloader */ >     /* and defaults to private constructor so it can't be used */ >   } This seems to be more complicated than Nicolas's version, and involve much more special magic, like the name __nsmeta, and the class that does nothing. I'm also not clear on how you're picturing the relationship between namespaces and packages. The way I understood the suggestion, you'd end up with something more like this, which feels much simpler and cleaner: # # File: /lib/company/project1/a/b/MyClass.php # 1,             'strict_operators' => 1,             'upgrade_errors_to_exceptions' => E_ALL         ];      } } Regards, -- Rowan Collins [IMSoP]