Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105120 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5983 invoked from network); 6 Apr 2019 05:18:08 -0000 Received: from unknown (HELO mail-lj1-f178.google.com) (209.85.208.178) by pb1.pair.com with SMTP; 6 Apr 2019 05:18:08 -0000 Received: by mail-lj1-f178.google.com with SMTP id f23so6824721ljc.0 for ; Fri, 05 Apr 2019 19:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=05PY8Sqs9hOOONGPh4fjzjQifhEPEUBM1oAdaSZadLQ=; b=BOsXk3EcsAKOdKG6m7Eo2PRieWl5q1C5t2qPuDhzYO6aQJR7o8W7tGQ6wCYwNSQULA pQv+lLMLfGVzGRCpgVxfQ1l2uTEH0QLbjvSl1ahN4FxrtYYhLy1+ZQ2NMIKW1P3g6+Cj iaK/U2oJWOOy8fjMCHxKWn8g8WJV8FbRa9S0F1YUJNZi31bNF5Y6yYT/ih5BdPcQvng3 Bm2SmL11OZ7xbD/MMZx3Cmu/vSTLDmqiwshk3MMNKp+uPepXpXpw6RxODNyIQyuzcA28 51vMSaw/ZQ8xNIHop7q54/MecC0geH7nj0z2GPRQf3kdqxj48uc7VR76z46lrzzG5dWV Z/sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=05PY8Sqs9hOOONGPh4fjzjQifhEPEUBM1oAdaSZadLQ=; b=gYRTL2eVUzKs+a4WlZNFs64yU24eXf0zo4fYFvGg+G4B4dujtCnnbZplsVpjMUpqW0 xbOl0a25tb6ad5yK7koozDelrsf7j/5VUQz91RBhC88qT0PnwnRNtN5Ik1a/FdK6xyrX gIIkrR8S4qKHXny6VXvAqiOSa2RIE++CwjtoMnaF+SrQ+vYaAUlHcgstBGoGcRAdCATO r4C3a5dPtdTXQ6vFBK1j5The4HNHjJ/CSfvDBczUBz1JPiJsDXfGo14Kz73khvSbigut T4dyy6LTbHd0bsvoFVFViyScrITF0WK4yPG4vOori2aPkwbEHpqbaBmZwMJ6ZJxq8/Zx aIwA== X-Gm-Message-State: APjAAAWKHkNEK56YyYbnVGaC7uDsu7Uq1cjo5U+yVHsb7a53w5Z1Y6Sn eMi5DtrQLPF/cmdrWijc32ncAwNTxOhoDgiQ3T8= X-Google-Smtp-Source: APXvYqwV0fCNCpz2QUQ1O2TDO4w8GRSOcYONCBHutbpVvhepeP9qOf1PVswyG9h/GaFeDfuISxZny9+uDUGBQ9n3Qls= X-Received: by 2002:a2e:2e04:: with SMTP id u4mr8548137lju.37.1554516849324; Fri, 05 Apr 2019 19:14:09 -0700 (PDT) MIME-Version: 1.0 References: <65AF9E1E-DFA6-47AE-952B-9ABEBD9B6038@gmail.com> <284d1f9f-03d3-1488-77dd-82e18edf9f4c@gmail.com> <3144F5D1-1F18-4C42-9B3E-AF1B1E598E47@koalephant.com> <917cb7bc-4abc-4bae-1a5a-b2ba1777fa55@gmail.com> In-Reply-To: Date: Fri, 5 Apr 2019 19:13:58 -0700 Message-ID: To: Benjamin Morel Cc: Rowan Collins , PHP internals Content-Type: multipart/alternative; boundary="00000000000099f6880585d3280a" Subject: Re: [PHP-DEV] Question about adding !function_identifier From: mo.mu.wss@gmail.com ("M. W. Moe") --00000000000099f6880585d3280a Content-Type: text/plain; charset="UTF-8" Hello, there is some trace of absolutism in every statements: first;;; saying php is a highly dynamic is not not fact but a sorry *** excuse; ain't part of engineering ; admitting php5 is a load of idiotic mistakes yes; I like people going for reality not ideology; with facts you can work with ideology; an infinite debate of nonsense with fanatics. second;;; you can properly handling it without a preprocessor as people trying hard to name it by going thru abusing statements about static analysis; it's all about handling an exception process properly; but it will require to break compatibility as I mentioned previously. Best. On Fri, Apr 5, 2019 at 10:03 AM Benjamin Morel wrote: > > > > Yes, I think we are rapidly approaching the limit where to make the > > language stricter, we need an official static analysis tool, like Hack > has, > > rather than trying to do everything at run-time. > > > It might even be possible to build this into OpCache somehow, so that if > > you pre-analyse your code, it will skip runtime checks that it can prove > > will never fail (e.g. return type annotation on a function that always > > returns literals). > > > > > The tricky part is that PHP is a highly dynamic language (...) > > > Features like scalar type hints, return types, property type hints, and > preloading (which makes the definition of a type-hinted class available at > compile time), should definitely help towards skipping a lot of runtime > checks! > > > On Fri, 5 Apr 2019 at 11:37, Rowan Collins > wrote: > > > On Fri, 5 Apr 2019 at 09:57, Robert Hickman > wrote: > > > > > > > > > > For instance: > > > > > > > > function foo(): type nothrow { > > > > throw new SomethingException; > > > > } > > > > > > Would it be possible to analyse the call graph at compile time > > > (bytecode generation) and then trigger a fatal error? It wouldn't be > > > possible for variable functions/methods though. A separate static > > > analyser could do the same thing. > > > > > > > > > Yes, I think we are rapidly approaching the limit where to make the > > language stricter, we need an official static analysis tool, like Hack > has, > > rather than trying to do everything at run-time. > > > > It might even be possible to build this into OpCache somehow, so that if > > you pre-analyse your code, it will skip runtime checks that it can prove > > will never fail (e.g. return type annotation on a function that always > > returns literals). > > > > The tricky part is that PHP is a highly dynamic language, so there's a > lot > > of cases where the analysis can only return "maybe". My understanding is > > that this is what a lot of the work on Hack is doing: creating a language > > which looks a lot like PHP, but doesn't have as many ambiguous cases > which > > can't be analysed statically. > > > > Regards, > > -- > > Rowan Collins > > [IMSoP] > > > --00000000000099f6880585d3280a--