Le 13/07/2014 15:17, Andrea Faulds a écrit :

On 13 Jul 2014, at 14:13, Jocelyn Fournier <jocelyn.fourn...@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.

Ok, in this case I would suggest always displaying a warning in E_STRICT since it's the whole purpose of the strict mode :)



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.


If I'm not able to use type annotation because I *really* want to enforce the calling function variable type, I'm potentially missing some optimisations. (but with warning in strict mode, all is fine)

  Jocelyn

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

Reply via email to