Re: Make primitive type names reserved words (Was: Re: [PHP-DEV] [RFC] 5.4 features for vote (long))
| From: | Pierre Joye | Date: | Sun, 10 Jul 2011 21:17:13 +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-53809@lists.php.net to get a copy of this message | ||
hi,
As I could agree on this fact, I can't find any existing project
having int(eger), float&co as class, namespaced or not. Do you have
any example at hand?
Cheers,
On Sun, Jul 10, 2011 at 6:41 PM, 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
>
>
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org