Re: [RFC] Namespace-scoped declares
| From: | Michael Morris | Date: | Fri, 23 Sep 2016 21:46:53 +0000 |
| Subject: | Re: [RFC] Namespace-scoped declares | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96121@lists.php.net to get a copy of this message | ||
On Friday, September 23, 2016, Nikita Popov <nikita.ppv@gmail.com> wrote:
> Hi internals!
>
> I'd like to propose the ability of specifying declare directives like
> "strict_types" at the namespace level.
>
> The broader context of this proposal is to provide a simple and usable
> mechanism that will allow developers to opt-in to stricter language
> semantics on a per-library (or more specifically, per-namespace) basis,
> thus alleviating backwards compatibility and library interoperability
> concerns for such changes.
>
> https://wiki.php.net/rfc/namespace_scoped_declares
>
> I don't know whether this is the right solution to this problem, so next to
> the specifics of this proposal, I'm also open to discussing alternative
> approaches, as long such discussions can be held at a reasonably technical
> level (i.e. concrete suggestions rather than vague concepts).
>
> Thanks,
> Nikita
>
Aside from the issues already raised, implementing anything like this would
require reworking how the engine handles namespaces. My understanding is
namespaces are implemented as a set of string replace rules. The namespace
itself is not a structure to php. This prevents things like class privacy,
Java's notion of "protected" and so on.