On 31 December 2014 at 12:27, Andrea Faulds <a...@ajf.me> wrote:
> Parameter type hints for PHP’s scalar types are a long-requested feature for 
> PHP. Today I am proposing an RFC which is a new attempt to add them to the 
> language. It is my hope that we can finally get this done for PHP 7.
>
> I’d like to thank Dmitry, who emailed me and gave me some feedback on the 
> draft RFC and some improvements to the patch. He encouraged me to put this to 
> internals sooner rather than later, as it’s a feature many people are hoping 
> will be in PHP 7.
>
> The new RFC can be found here: https://wiki.php.net/rfc/scalar_type_hints

At a first read through, this looks great, and much more in line with
what I'd like scalar type hints to look like. Nice job!

In terms of the open issues, here's what I think:

1. Aliases: I think we should support the same set of names as we
currently support for type casts[0] (excluding non-scalar types,
obviously) — this actually expands the list a little more, since there
are three (!) variants for floating point values, but I think it's
important to be consistent in all the places in the language where we
use "type" names.

2. Prohibiting use in class names: I think this makes sense, otherwise
we'll be violating the principle of least surprise when somebody does
call a class Int. (Yes, namespacing might help here, but I think I'd
rather restrict it altogether rather than trying to come up with rules
around when you can call a class "int" and how you'd refer to it.)

To bang another drum (and this shouldn't be responded to in this
thread, since we have another one going for this RFC): this sort of
change is why 5.7 is vital for migration — emitting deprecation
warnings for users calling classes by names that we'll be prohibiting
in PHP 7 is important, and will help our users migrate their code
bases.

I haven't looked at the patches yet, but assuming they're good, my
initial feeling is +1. Good work on taming the beast. :)

Adam

[0] 
http://php.net/manual/en/language.types.type-juggling.php#language.types.typecasting

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to