Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37227 invoked from network); 20 Feb 2015 23:28:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 23:28:52 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.52 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.215.52 mail-la0-f52.google.com Received: from [209.85.215.52] ([209.85.215.52:38133] helo=mail-la0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/C3-14173-133C7E45 for ; Fri, 20 Feb 2015 18:28:51 -0500 Received: by lamq1 with SMTP id q1so9172267lam.5 for ; Fri, 20 Feb 2015 15:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3Tw/Eqd3EheFjTqorW02S9VViq4prN+DFZk4wqBCe/I=; b=Ot69apd4Yc5tlVK1xJ1ANwlSEv8sVmhlvcLKdIGcbRt6Qa9Fvwm+GKl8LbKJscnw/u 1CD3xi+2kqY4yRSLk5GhhB30HQngjkACEeLsy+KM4ynaNfGxrB22XuBpPdsjen1SBq3t EsFLzVcQjWgq6EeNp1QvREn/R/mSygVwIeYRINJbPSxpjTMdj0ll7Pgm2BxN1+7I7b69 CaYxYnNGwl/s/7HUEdOu7BjcilBJJUM1rXj6J9/Tc0TUIm0Wr9CA2KayZFP1RBfOCerD xK0o1el7dI9MXu0CXvzdhlNqw2o1RE9MlAdaSCTFFYQb/mjgSpZJf2vMx5QtoMKj3EMO TyCg== MIME-Version: 1.0 X-Received: by 10.152.88.49 with SMTP id bd17mr87074lab.43.1424474926822; Fri, 20 Feb 2015 15:28:46 -0800 (PST) Received: by 10.25.43.9 with HTTP; Fri, 20 Feb 2015 15:28:46 -0800 (PST) In-Reply-To: <012001d04d46$271dac90$755905b0$@tutteli.ch> References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <022801d04ab1$4a0c47d0$de24d770$@php.net> <1913e09d7f52541901d8574d2080a63f@mail.gmail.com> <7a5d96b34b98ec1f3ee17be7fa6a1e81@mail.gmail.com> <2CBDEB67-3DE3-437D-9AF3-0E6A92027244@zend.com> <4cc0c81c7199a452534bb8edcdb19914@mail.gmail.com> <54E589F6.9030002@garfieldtech.com> <54E66569.8000709@garfieldtech.com> <012001d04d46$271dac90$755905b0$@tutteli.ch> Date: Fri, 20 Feb 2015 18:28:46 -0500 Message-ID: To: Robert Stoll Cc: Dmitry Stogov , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Reviving scalar type hints From: ircmaxell@gmail.com (Anthony Ferrara) Robert, On Fri, Feb 20, 2015 at 2:48 PM, Robert Stoll 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