Re: [RFC] Scalar Type Hints
| From: | Pierre Joye | Date: | Sat, 03 Jan 2015 04:50:06 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80113@lists.php.net to get a copy of this message | ||
hi Andrea,
On Wed, Dec 31, 2014 at 12:27 PM, Andrea Faulds <ajf@ajf.me> wrote:
> Good evening,
>
> 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
>
> As well as the RFC, there is a working Zend Engine III patch with tests, and an incomplete
> specification patch.
>
> Please read the RFC (and specification patch, if you wish) and tell me your thoughts.
Thanks, great work and persistent effort!
As I am also slightly in favor of a strict way, this RFC is a good compromise.
Some comments:
- on-numeric strings not accepted. Numeric strings with trailing
characters are accepted, but produce a notice.
I would rather not allow fancy conversions here. Any trailing non
white spaces characters should not be allowed. I know it is not what
PHP does now in some cases but this is really a fuzzy area and never
really matched any actual needs or usages.
I am also not a fan of errors, exception, at least for methods, make
much more sense. I know it is relatively easy to handle errors as
exception but still, let do it right now.
Cheers,
--
Pierre
@pierrejoye | http://www.libgd.org