Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101326 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65218 invoked from network); 11 Dec 2017 15:56:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2017 15:56:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.51 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.51 mail-it0-f51.google.com Received: from [209.85.214.51] ([209.85.214.51:44973] helo=mail-it0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/2E-53433-2AAAE2A5 for ; Mon, 11 Dec 2017 10:56:19 -0500 Received: by mail-it0-f51.google.com with SMTP id b5so16962636itc.3 for ; Mon, 11 Dec 2017 07:56:18 -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 :cc; bh=A5zHJKctnZrXk69+G8eV7K4js+z8tCZo1Yu+EHBFu08=; b=cBZ4TfRB+ydyd2kRqNHDwIoHpfq+ha7fnQYLgjkHvaOLLkiKyWPNWP6kCA4dYHvBbt eqMg5n8xPNsydcqpaD/W+1esTdjOFgpuwKl9dV1Xl2RFV5+Yk9EtyE8OV7A0sAP2y/mQ IElbdM+YAK8W3CYf892UEPcgOixjVeqHVV6LsVJIxMDl1/jAqrUnRAKyl0dUcudGLzfW bh8KUJlrnhEYGoNEsgV5xs79ym/6lsp1mSPM3oQYFyVvhQmbFLRNis0gxyvjuQ6DFqGk zF30w4Syu+8qhk73ac8QsvcLrRnmH5iumqpAcQAVLvn8Q0wDiFTAAB/q2OY/mMyNHo0T EWbg== 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:cc; bh=A5zHJKctnZrXk69+G8eV7K4js+z8tCZo1Yu+EHBFu08=; b=DkSJDeJxtQz8Y9UVAPFZQRbQNwtLWv8r+izR6uBtgjpbJRC9tu9jHV6GbZMtxKnjRd itEYEfEIpyA9qYvS8K8M5SvL3iQ1KB/brthFx533Q4PHFhEA0/cx6i6hFivazq/YUOAi qI0AimoquLE3adne9ayBUr7fwKFaFiCUuMROCYrb8ajkyYH1BNOhvb0SHmbqdzQ6mrVx VmshG2UdH50v0XnoK/YTjA+u71bkkd2rCzmc6JMIvoMB9NLj38pqhRHvkbgPajU2WP1G cQRTTFkWv+34r+JnatISKFlWCKdZJ3oBxeMje1tazWDfqSnMLqnt9GWxKZ1DGeariC78 R3hQ== X-Gm-Message-State: AKGB3mLIbSwtdFp5MijeNNgzH4p+uMOz34u8FNQ7GEo7tE8HO3R6f6Ui grqpDAZet8kou+i04yqa+rCs2r4slJWkSXIsYVU= X-Google-Smtp-Source: ACJfBouHcNgSptU5tL7EjtaWpRo5CzHJfpUhw4C5Fr/SNLBqyAeRaXIgb5jVEYyfCn0hw9j+7Scafiu+3KAIVEyAEGk= X-Received: by 10.107.139.69 with SMTP id n66mr1105073iod.6.1513007776561; Mon, 11 Dec 2017 07:56:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.93 with HTTP; Mon, 11 Dec 2017 07:56:16 -0800 (PST) In-Reply-To: References: Date: Mon, 11 Dec 2017 16:56:16 +0100 Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary="94eb2c0551c61080a9056012933a" Subject: Re: [PHP-DEV] [RFC] Namespace-scoped declares, again From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c0551c61080a9056012933a Content-Type: text/plain; charset="UTF-8" On Mon, Dec 11, 2017 at 4:46 PM, Sara Golemon wrote: > On Mon, Dec 11, 2017 at 8:43 AM, Nikita Popov > wrote: > > Some time ago I introduced the following proposal for namespace-scoped > > declares: > > > > https://wiki.php.net/rfc/namespace_scoped_declares > > > > The idea is to allow specifying declare directives for a whole library or > > project using: > > > > namespace_declare('Vendor\Lib', ['strict_types' => 1]); > > > > I've finally gotten around to implementing this proposal ( > > https://github.com/php/php-src/pull/2972) and would like to move forward > > with it. > > > Being lazy here because I'm literally on my way out the door and don't > have a moment to parse through the implementation, but can you clarify > how this impact compile-time declares? > > > require('a.php"); > require('b.php"); // This file has a namespace declaration > require('c.php"); > > In this example, does a.php wind up getting compiled with a different > set of declares than b.php and c.php? > > -Sara > Nope. The namespace_declare() call in this case will throw an Error, because code using that namespace has already been loaded. The implementation is careful to ensure that it's never possible to end up in a situation where the used declare directives are inconsistent. Nikita --94eb2c0551c61080a9056012933a--