Re: Re: Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long))
| From: | Ferenc Kovacs | Date: | Mon, 11 Jul 2011 15:14:23 +0000 |
| Subject: | Re: Re: Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long)) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53878@lists.php.net to get a copy of this message | ||
On Mon, Jul 11, 2011 at 5:08 PM, Matthew Weier O'Phinney
<weierophinney@php.net> wrote:
> On 2011-07-10, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>> On 7/10/11 9:41 AM, Patrick ALLAERT wrote:
>> > Developer may have taken care of defining them in a specific
>> > namespace, would it be possible to not break their application while
>> > making them reserved keywords in the global namespace only?
>>
>> I don't think there's such thing in PHP as namespaced keywords. Keywords
>> are processed by the language parser, which knows next to nothing of
>> namespaces.
>> We could, maybe, prohibit creation of classes with names identical to
>> type names, which is different from making it reserved word, and on that
>> stage we know the full class name.
>
> I think that's a bad idea. The point of namespaces is to allow us to
> override classes (and functions, and constants) within that namespace.
> If I can't do this:
>
> namespace Foo
> {
> class String
> {
> }
> }
>
> then I'd consider the implementation too restrictive.
>
the parser is a little bit dumb, and the namespaces isn't really first
class citizens in php AFAIK, so it's not a deliberate restriction imo,
just a technical, which could be solved.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu