Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83517 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7582 invoked from network); 23 Feb 2015 00:43:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2015 00:43:58 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.181 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.213.181 mail-ig0-f181.google.com Received: from [209.85.213.181] ([209.85.213.181:40997] helo=mail-ig0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/B1-33016-CC77AE45 for ; Sun, 22 Feb 2015 19:43:57 -0500 Received: by mail-ig0-f181.google.com with SMTP id hn18so14822560igb.2 for ; Sun, 22 Feb 2015 16:43:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=B/s9PpHon4jnoMvomoHsipwF1Cv2pnDp09WJNkfRJiU=; b=YK80H9qEzn5mfIG+9oXBjKsm+jN9P4f8+YpODExpq97K4jGPyq1v8CqX3oWK6UIXt3 kG2fztIkZSsisdUr5V+QDMCxZMPJBPH4sGbX+n+Y2S4zk90dwQkIpVJXGdAjARnBoyeQ Tbfy4e9pHkcCK6ufK8H4uqdLhK1OkLBkCC36wCkz0BAokm3MONnzNPel29pf2NezmEoa ZbowjGQDd8ATAa5n8KlavuIE96qpsblWpQbL1bXFuxGNkb/xrFo2AvgzurHc6g7AQpIr a26XZuWkybKZGl52+dCA+fF18DGUtVt0xUZn2uPTEjoM5lhikzs0YhvVi8DV7lBjTywR j+qg== X-Gm-Message-State: ALoCoQks6hpTSSQeJlbMj4pLCTHCCrDked3i9r/0BJ1uVt4kGH6GybbX2TONN18Z9IuXpcftl5gUqkJ8dqMGBxqF3ZJBc4/3+jWx/x/CxMVH5x1T77+hgy6f2IeBteXF8aWR0lWpUZQHugE0xhtDUe0u2HOVBtw1DQ== X-Received: by 10.50.39.112 with SMTP id o16mr9925913igk.0.1424652233311; Sun, 22 Feb 2015 16:43:53 -0800 (PST) References: <2e4694f9805ee81ea0b2c79eab06c2d6@mail.gmail.com> <83921f861c3378dfc6ea34b6681f2edd@mail.gmail.com> <26a5bb62bd37a3f610b2a6c10f84d855@mail.gmail.com> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIDXD7ehmaYKzbAddTs7O1sB4MzmgIw+OLdAfG9oisCHTTwrQKy9+dWAdPf8sKcQRFQoA== Date: Mon, 23 Feb 2015 02:43:52 +0200 Message-ID: <6d317b6cce0cc1aaded1dae11218234d@mail.gmail.com> To: Anthony Ferrara Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Anthony Ferrara [mailto:ircmaxell@gmail.com] > Sent: Monday, February 23, 2015 2:25 AM > To: Zeev Suraski > Cc: PHP internals > Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints > RFC) > > Ze'ev, It's Zeev, thanks :) > Because strict types makes that an error case. So I can then tell the user > to > fix it. Once they do (via cast, logic change, etc), I know the types of > every > variable the entire way through. So I can generate native code for both > calls > without using variants. I think we are indeed getting somewhere, I hope. If I understand correctly, effectively the flow you're talking about in your example is this: 1. The developers tries to run the program. 2. It fails because the static analyzer detects float being fed to an int. 3. The user changes the code to convert the input to int. 4. You can now optimize the whole flow better, since you know for a fact it's an int. Did I describe that correctly? > With strict typing at the foo() call site, it tells you that $input has to > be an int > or float (respectively between the snippets). I'm not following. Are you saying that because foo() expects an int or float respectively, $input has to be int or float? What if $input is really a string? Or a MySQL connection? Or are you saying that there was a strict type hint in the function that contains the call to foo(), so we know it's an int/float respectively? If so, how would it be any different with a coercive type hint? > I hope that makes my point a little clearer, It actually does, I hope. I think we are getting somewhere, but we're not quite there yet. Thanks, Zeev