Re: Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long))
| From: | Sammy Moshe | Date: | Sun, 10 Jul 2011 16:57:38 +0000 |
| Subject: | Re: Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long)) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53798@lists.php.net to get a copy of this message | ||
There's going to be a ton of code in the wild that will break if primitive
types become reserved words.
On Sun, Jul 10, 2011 at 11:41 AM, Patrick ALLAERT <patrickallaert@php.net>wrote:
> 2011/6/17 Stas Malyshev <smalyshev@sugarcrm.com>:
>
> [snip]
>
> > 2. Make primitive type names reserved words (in case we ever want some
> form
> > of scalar typing or anything else with scalar types). Using them as
> > identifiers would return parse error for now. May have BC implications.
>
> I am not sure it is a good idea to make them reserved words without a
> clear reason for doing so.
>
> I'm sure some projects have defined classes with those keywords in
> some namespace (to ensure they wouldn't conflict with possible PHP
> built-in stuff) like in:
>
> namespace \Types {
> class Int {
> // ...
> }
> class Float {
> // ...
> }
> class String {
> // ...
> }
> // ...
> }
>
> 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 would be +1 if this could be done for the global namespace only.
> However, -1 if this would break the usage of classes like \Types\Int,
> \Types\String, ... would break.
>
> Please, rethink your vote taking this into account. I don't think it
> is required to hurry up on that decision while we still don't have a
> *clear* proposition for scalar type hinting.
>
> Cheers,
> Patrick
>
> [snip]
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>