Re: [PHP-DEV] T_IMPORT vs. T_USE
Johannes Schlüter <johannes <at> php.net>
2007-10-01 11:24:10 GMT
Hi Sebastiann et al.,
On Sun, 2007-09-30 at 18:06 +0200, Sebastian Bergmann wrote:
> When we removed the namespace implementation that was scheduled for
> PHP 5.0 before PHP 5.0's release we kept the T_NAMESPACE and T_USE
> tokens for forward-compatibility.
T_NAMESPACE is new, only T_USE wasn't removed back then. afaik.
> The new namespace implementation in HEAD and PHP_5_3 uses the the new
> T_IMPORT token instead of T_USE thus breaking code as "import" is now
> a reserved word.
>
> We should, IMHO, drop T_IMPORT and change the namespace implementation
> to use T_USE.
>
> Thoughts?
Well, import seems to be a word used quite often in PHP for method
names, after I found some code breaking I did a short test using
Google's Codesearch[1] to look for method calls using "->import(" and
got "about 300" results including major apps like horde, tikiwiki, typo3
and wordpress.
Therefor I think it's worth to at least think about using the already
reserved, but not used, keyword "use". From taking a look at the
language (the English one in this case
) a sentence like "use
Namespace::SomeClass as SomeClass" makes perfect sense to me - but I
don't know much about the concept of Perl's (and other language's)
meaning of "use", BUT, we're neither Java nor Perl but PHP so we should
(Continue reading)