Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long))
| From: | Patrick ALLAERT | Date: | Sun, 10 Jul 2011 16:41:10 +0000 |
| Subject: | Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long)) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-53797@lists.php.net to get a copy of this message | ||
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]