On Mon, 2024-08-05 at 12:27 +0100, Derick Rethans wrote:
> On Sun, 4 Aug 2024, Nick Lockheart wrote:
> 
> > https://wiki.php.net/rfc/global_function_parser_directive I am
> > asking 
> > that we discuss and vote on the following question:
> > 
> > “Should there be some way for developers to signal to the parser at
> > compile time that all unqualified function names found in a
> > namespace 
> > context are global, without a namespace lookup?”
> 
> I don't beleive that we should introduce a switch for this at all,
> just 
> like the conclusion was in
> https://wiki.php.net/rfc/use_global_elements
> 
> 

In that RFC, the proposal was:

declare(function_and_const_lookup='global');

I'm not sure the conclusion was that there shouldn't be a way to
control the NS lookup behavior. That's what I'm trying to determine
with this new RFC: whether it was the entire concept, or just the
syntax or mechanism that was disfavored.

Do people agree that there should be *some way* to use only global
functions without an NS lookup as a *concept*?

Or, did they not like the syntax of:

declare(function_and_const_lookup='global');

?


Because that RFC has four things in it:

(1) A Concept that global functions should be used without an NS lookup
(2) A Concept that global *constants* should be usable without an NS
lookup.
(3) A syntax being proposed.
(4) The idea that functions and constants should both be controlled by
the same directive.


I think that other RFC was on the right page, for the most part, but I
think the syntax could be improved.

Which is why I had suggested a new keyword as part of the namespace
declaration in some of my other posts.

Something that would look like one of these:

// Disable NS lookup; use all *global* functions unless
// a \foo\ appears before the function name:

namespace foo using global functions;


// Disable NS lookup; use all *local* functions unless
// a \ appears before the function name:

namespace foo using local functions;


// Use NS lookup. Same as today, no BC break:
namespace foo; 

Reply via email to