Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83557 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22210 invoked from network); 23 Feb 2015 09:48:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2015 09:48:51 -0000 Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.50 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.192.50 mail-qg0-f50.google.com Received: from [209.85.192.50] ([209.85.192.50:41693] helo=mail-qg0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/7A-01128-187FAE45 for ; Mon, 23 Feb 2015 04:48:50 -0500 Received: by mail-qg0-f50.google.com with SMTP id e89so23350442qgf.9 for ; Mon, 23 Feb 2015 01:48:47 -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=CB5gV7bAcFGSX0n3IoAqQnTtBpCVKNBl/AQbVceS8hU=; b=Eio3eVugLwahlwVwz2GtjcdaPaYgFhQkWWBK1TJhH2k9Yu7jH2b+/MmZpWFd3X2M8j tRTWDFTV2pG+DsgXniEpzZad201fxplg8Cmuqgc9Cyc4gJPHaRuZmXIfod98GHUl7CFV B6fSS/Sva3WUVFroWRZAflDpoMh4tQT7mMesb38VgYe8raFTop8/xj3tqW0N+zQXW5Lr SqYKoJea5mBS7zR8py36LpTTKc20PMnMsIRIJG7acfvJbldx994a+VNF8HIU2fvMW8os UKdqk3+/zE48cUVA9pJ0LPm60xrUO3cGFfw6apGyGFsBa88JcZDj31ZKi8Mn9KIE2xg9 SUiQ== MIME-Version: 1.0 X-Received: by 10.140.231.151 with SMTP id b145mr22753932qhc.22.1424684927011; Mon, 23 Feb 2015 01:48:47 -0800 (PST) Received: by 10.96.160.99 with HTTP; Mon, 23 Feb 2015 01:48:46 -0800 (PST) In-Reply-To: References: <2e4694f9805ee81ea0b2c79eab06c2d6@mail.gmail.com> <54EA5EDA.8010605@gmail.com> <54EA6A99.5010609@gmail.com> <54EA7F15.9030606@gmail.com> <54EA891B.6030405@gmail.com> <09b9ee836c04b1750614a91bd39a5bed@mail.gmail.com> <54EA97A2.4010701@gmail.com> <661590f4daa710176268b43c1b950583@mail.gmail.com> Date: Mon, 23 Feb 2015 10:48:46 +0100 Message-ID: To: Joe Watkins Cc: Zeev Suraski , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Mon, Feb 23, 2015 at 10:28 AM, Joe Watkins wrote: > Zeev, > >> If you can infer the type with confidence, you can do away with coercion > code altogether. > > Maybe I'm ignorant of something, but isn't the only way you can begin to > infer the type with real confidence is by having strict typed parameters ? > > This sounds like the kind of strict mode we're talking about, where no > coercion is necessary because inference is so reliable given a good > starting place (function entry with strictly typed parameters). > >> If you can't, then you're not obligated to generate optimized paths for > every possible input - you can just defer to the relevant coerce() function. > > If the parameters aren't strict but are typed then you need to travel > coercion code paths somewhere, optimized inline, calling an API function, > it makes no real difference. > > I guess we are hedging our bets that having to travel those paths will suck > away so much performance, that it will make all of the effort required to > make any of this a reality seem, somehow ... wasted. > >> JIT might end up being about making PHP viable for more CPU-bound use > cases ... > > This is probably quite realistic. > > In case anyone is reading and thinks I'm using any of this to justify dual > mode, I'm not doing that. The original RFC justified it well enough, I just > happen to disagree with some of the assertions made in this thread and or > RFC. > Hello, if I understand the issue correctly, not even strongly typed parameters won't help you infer types of variables with real confidence? Imagine this piece of code: function foo(int $x) { $x = fnThatReturnsRandomScalarType(); return $x; } Regards Pavel Kouril