Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83510 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95201 invoked from network); 22 Feb 2015 23:56:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2015 23:56:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.51 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.51 mail-qa0-f51.google.com Received: from [209.85.216.51] ([209.85.216.51:45906] helo=mail-qa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/5E-18531-6AC6AE45 for ; Sun, 22 Feb 2015 18:56:22 -0500 Received: by mail-qa0-f51.google.com with SMTP id i13so19951996qae.10 for ; Sun, 22 Feb 2015 15:56:19 -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=60B7NpZLEu7LfFIYpcnxg+qLO14cw1rshtbtEr9n3Io=; b=QsK2c1sTQ+yhToKMCqiRKd2URJbxueKlRe1c2EpJxXPby/rM0NFFsuQ6yzmxxB2icp IeHZPbuws1xqX+A6i042+Ik2/Hulgjp/9wGdbzLRlsKa0rb4FGkP5hM0Ig7JpRv69VTW 3o4VsJ0sNFK0qQI+19/8gAgOTgSMkS4JhsrcmjqWogn2W3q6wIn1U093pWDFfque9s2l b0JCehRxs1cwH6d7Rr6vf3S2tLbLQNa2ZPU/qQZsD1XBP/3H+cKjh79TXfuHEJhp0ETy m6NoVULgRC4Fc2MeWe8uryXmf0dXaaEvUVqcdi3UfYPM+CFhhiMsHZAXtEhfCyv/vGp2 BTVA== MIME-Version: 1.0 X-Received: by 10.140.102.165 with SMTP id w34mr19140095qge.26.1424649379501; Sun, 22 Feb 2015 15:56:19 -0800 (PST) Received: by 10.96.39.195 with HTTP; Sun, 22 Feb 2015 15:56:18 -0800 (PST) Received: by 10.96.39.195 with HTTP; Sun, 22 Feb 2015 15:56:18 -0800 (PST) In-Reply-To: References: Date: Sun, 22 Feb 2015 15:56:18 -0800 Message-ID: To: Anthony Ferrara Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c1689031de42050fb60896 Subject: Re: [PHP-DEV] Coercive Scalar Type Hints RFC From: pierre.php@gmail.com (Pierre Joye) --001a11c1689031de42050fb60896 Content-Type: text/plain; charset=UTF-8 Can you all of you stop this madness with moving discussions off list? It is detestable, against almost all openness and principles behind an oss project like php. If we can't discuss anymore design, plans, ideas etc on the list then we are doomed, for good. On Feb 22, 2015 3:49 PM, "Anthony Ferrara" wrote: > Adding in a thread that was started in private, but absolutely is > worth sharing with the group: > > > ---------- Forwarded message ---------- > From: Etienne Kneuss > Date: Sun, Feb 22, 2015 at 8:42 AM > Subject: Re: [PHP-DEV] Coercive Scalar Type Hints RFC > To: Zeev Suraski > Cc: Anthony Ferrara , Dmitry Stogov > > > > > On Sun Feb 22 2015 at 14:23:58 Zeev Suraski wrote: > > > > > There have been several attempts: > > > for JS: http://users-cs.au.dk/simonhj/tajs2009.pdf > > > or similar techniques applied to PHP, quite outdated though: > > > https://github.com/colder/phantm > > > > Looks like WebKit's type inference is doing some pretty good job at > > analyzing code, although I'm not sure how much of it is static vs. > dynamic. > > My guess is that a lot of it is static: > > twitter.com/kangax/status/558974257724940288 > > > My guess would be that it's almost entirely dynamic, or probabilistic > (e.g. this nice recent work done at ETH: http://www.jsnice.org/). > > I think you underestimate the difficulty of statically recovering > precise types from no-annotations without runtime witnesses ;) You > don't want webkit anlysing the JS for 10 minutes until it renders the > page. It is much more profitable to JIT these. > > > > > > > > > > You are right that the lack of static information about types is (one > of > > > the) a main issue. Recovering the types has typically a huge > performance > > > cost, or is unreliable > > > > We're not really talking about performance issue here, as static > analysis is > > a separate activity that is unrelated to runtime performance. > > > What I meant was: it is a performance issue for the static analyzer, > not PHP itself. > > > > > > > > But seriously, time is getting wasted on this argument; it's actually a > > > no-brainer: more static information helps tools that rely on static > > > information. Yes. Absolutely. 100%. > > > > There's still disagreement between us on whether the different behavior > of > > Strict STH constitutes additional static information or not, as it > doesn't > > give you any extra information on the value being fed to the function, > and > > it doesn't give you any extra information on what the function will > receive. > > It only gives you information about how the function would behave if it > gets > > a wrongly-typed value. > > > > 1) for forward analyses (which are the most common for these > applications): it gives you precious information from the beginning of > the function and forward. You can consider it similarly to a cast: You > don't necessarily know what the value coming in is, but you know which > type you are having from that point forward. > > 2) backward analyses could piggy-back the type constraints from the > functions (strict or no strict) and check that they are met when > constructing the value fed to the function. > > Having worked several years on static analysis tools for languages > such as PHP, I can guarantee you that this information would help a > lot. However, the other dynamic feature of PHP would still make > analyses slow/unreliable/imprecise. Let's not imagine that this is the > only thing missing for PHP to be static-analysis-wonderland, far from > it. > > > > > But my the bottom line is exactly the bottom line you ended with, and > what I > > answered you on-list - how much weight should Static Analysis > improvements > > have on our decision to introduce new language features? My answer is > not > > that much, if they have downsides. Static Analyzers should be designed > for > > languages and not vice versa. > > > I fully agree in general that the flow should be this way. But it > remains a bonus if a certain feature, as a plus, would help external > tools. I believe it is worth mentionning.. > > > > > Thanks, > > > > Zeev > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11c1689031de42050fb60896--