Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Andrea Faulds | Date: | Sun, 13 Jul 2014 13:17:54 +0000 |
| Subject: | Re: [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75395@lists.php.net to get a copy of this message | ||
On 13 Jul 2014, at 14:13, Jocelyn Fournier <jocelyn.fournier@gmail.com> wrote:
> Actually displaying a warning in E_STRICT but still doing the implicit cast would not change
> the function signature.
Sure. What I meant was more that we’re changing expectations based on php.ini/variable/etc., and
I’d rather it’s always consistent.
>
> Indeed :) But I have also performances in mind. Usually (at least in HACK / Zephir), "type
> hinting" is used to help the compiler optimize the code. If this type hinting could be useful
> to help my code working in a futur PHP->PECL compiler, or help the PHP opcache to do some
> optimisations, I'd like to use "type hinting" as much as possible.
>
> But with the above limitation, I'll not be able to do so.
I think this type hinting wouldn’t hinder optimisation. Casting means that it’s still guaranteed
that the value you get is of the requested type.
--
Andrea Faulds
http://ajf.me/