Re: T_IMPORT vs. T_USE
| From: | Pierre | Date: | Thu, 18 Oct 2007 10:08:12 +0000 |
| Subject: | Re: T_IMPORT vs. T_USE | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32847@lists.php.net to get a copy of this message | ||
On 10/18/07, Andi Gutmans <andi@zend.com> wrote:
> Main problem I have right now after digging deeper is that any such "fix" in the
> parser will mean that tokenizers and syntax highlighters will not treat keywords like
> "import" correctly. Fixing this would require them to do parsing which in many cases you
> don't want to do. There are a lot of utilities and tools which depend on such behavior.
> Even if it's just for this reason it may be better if we stick to the "a keyword is a
> keyword" rule and don't try and outsmart ourselves (other languages like C have discovered
> the same issues and stuck to the keyword only rule too). So it may make most sense to go ahead and
> use "use".
If we stick to this rule, we can't add new keywords in minor/patch
versions. (x.y+1 or x.y.z+1) as it break BC. With import, a lot of
codes is affected even if they use "import" as method name (said
already, add symfony to the list).
I really don't care about use or import but for what I see, import is
going to break (as said already) a lot of apps/codes out ther (add
symfony to the list).
I would prefer Stan's patch to allow keyword to be used as
class/method/function name. At the very least (the patch has
unsolvable issues), I have to agree with Andi, we should just go with
"use" (codesearch returns less than 10 results :).
Cheers,
--Pierre