Robert,


On Fri, Feb 20, 2015 at 2:48 PM, Robert Stoll <p...@tutteli.ch> wrote:
> Hi Dmitry and Anthony,
>
> I was skimming through your conversation about JIT/AOT and that type hints 
> would allow to optimise few things.
> I do not know if you are aware of the following but type hints can be passed 
> by. Hence neither weak or strict type hints allow to predict the type (even 
> if only locally):
>
> function handler($errno, $errstr, $errfile, $errline){
>     return true;
> }
> set_error_handler("handler");
>
> class Foo{}
> function foo(int $x, Foo $f){
>   var_dump($x, $f);
>   $y = $x; //should be int as well, right?
> }
> foo(new Foo(), 1);
>
> Sure, this is something which is hopefully never ever done but anyway, a 
> language needs to be able to handle all cases.
>
> As a side notice, if the exceptions in the engine RFC is accepted, then this 
> would not be a problem anymore:
> https://wiki.php.net/rfc/engine_exceptions_for_php7
>
> Personally, I would expect that the execution is stopped after the 
> error_handler was called (after user was able to log etc.)  - at least in 
> strict mode.

That's a very good point.

Ideally exceptions will help there as it will simplify things
significantly. But even without them, it should be possible to bypass
execution.

Considering I'm not targetting 7 (I've updated the RFC to hint this),
we can choose what to do later depending on the exceptions result
(whether to bypass execution in strict mode only, or for all calls).

Thanks for the insight

Anthony

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

Reply via email to