Re: Re: [RFC] "use global functions/consts" statement
| From: | tyson andre | Date: | Sat, 18 Jan 2020 22:53:22 +0000 |
| Subject: | Re: Re: [RFC] "use global functions/consts" statement | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108197@lists.php.net to get a copy of this message | ||
> I'd much rather have something like:
>
> declare(ambiguous_element_lookup=0)
>
> declare(ambiguous_element_lookup=off)
Aside: declare(unambiguous_element_lookup=1) is probably a better choice than my first choice of
(disable_ambiguous_element_lookup=1), but probably not the best choice.
> I find that the “disable_ambiguous_element_lookup” directive name is, well, ambiguous.
> Does it mean that it will look up only in the current namespace, or only in the global
> namespace? I can’t guess.
>
> Maybe a three-value directive:
>
> declare(function_and_const_lookup=global);
> declare(function_and_const_lookup=namespace);
> declare(function_and_const_lookup=fallback); // the default
That's my favorite setting name overall so far - it ends up being as long as
disable_ambiguous_element_lookup and more self-explanatory.
I don't plan to include namespace-only in the RFC - future RFCs could propose additional values
independently.
Probably just
= global and = default, because the default might eventually
change (from the fallback),
and = fallback could be added if the old fallback was desirable enough.
- = default would only be useful to set resolution back to the default
with future language changes such as https://wiki.php.net/rfc/namespace_scoped_declares#implementation_considerations
> "namespace_lookup"
It might cause confusion when a new php programmer tries to set this setting,
and discovers that catch(Exception) {} still means MyNS\Exception with
declare(namespace_lookup=global).
(assuming you meant something along those lines)