Re: Opt-in "use function *;" for skipping check for function/const in alternate namespace

From: Date: Thu, 28 Nov 2019 11:01:00 +0000
Subject: Re: Opt-in "use function *;" for skipping check for function/const in alternate namespace
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-107882@lists.php.net to get a copy of this message
> Le 28 nov. 2019 à 10:35, Rowan Tommins <rowan.collins@gmail.com> a écrit : > > On Thu, 28 Nov 2019 at 00:02, tyson andre <tysonandre775@hotmail.com> wrote: > >> - Due to the absence of function autoloading (not supported in php to >> performance overhead), functions outside the global scope are rare in >> practice. >> > > > If this is a valid justification, perhaps we should do the opposite of the > "deprecate fallback to global scope" RFC you mentioned, and make the "use > function *" behaviour the default in some future version. That would > provide us longer term benefits, such as being able to introduce function > autoloading. I think it is better to keep the language as regular as possible, and consider that every non-fully-qualified name is relative to the current namespace, unless there is an explicit use declaration that says otherwise > > An opt-in mechanism is certainly easier to migrate to, but it would be a > shame if every PHP file in 10 years time included a line like this: > > use function *; // don't know what this does, but apparently it's good for > performance ¯\_(ツ)_/¯ Or: “don't know what this does, but apparently it silences deprecation notices...” The issue indeed is that the meaning is far from self-evident. Maybe one could use something that everyone and their mother could understand at first reading, such as: use function from global namespace; —Claude

« previous php.internals (#107882) next »