Re: [RFC] Namespace-scoped declares, again

From: Date: Tue, 12 Dec 2017 16:32:57 +0000
Subject: Re: [RFC] Namespace-scoped declares, again
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-101337@lists.php.net to get a copy of this message
On 11.12.2017 at 14:43, 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. Generally I'm not keen on letting the language diverge via whatever mechanism, but that has already happened and there seems to be some further need, and the namespace scoped declares appear to be preferable to per-file declares or even ini settings. What I don't like about the present proposal is that it introduces a proper function instead of a language construct. Is there a particular reason for this design decision? Couldn't we add the namespace scoped declares to the namespace declaration directly, e.g. namespace Foo declare strict_types=1; -- Christoph M. Becker

« previous php.internals (#101337) next »