Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81973 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88193 invoked from network); 5 Feb 2015 23:14:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 23:14:51 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:53998] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/01-17766-A69F3D45 for ; Thu, 05 Feb 2015 18:14:51 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 659CC240256; Thu, 5 Feb 2015 18:14:47 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1qx_STEJCxh5; Thu, 5 Feb 2015 18:14:47 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id D5B992407E3; Thu, 5 Feb 2015 18:14:43 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: Date: Thu, 5 Feb 2015 23:14:40 +0000 Cc: Stanislav Malyshev , Sebastian Bergmann , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <00c101d04049$ca411ec0$5ec35c40$@tekwire.net> <54D1CA7C.8060204@php.net> <54D1E6EC.7060702@php.net> <54D2B3FA.6020900@gmail.com> <5EFCBA22-D032-4444-8E11-F44FA07A722A@ajf.me> To: Dmitry Stogov X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] What do we need strict scalar type hints for? From: ajf@ajf.me (Andrea Faulds) Hi, > On 5 Feb 2015, at 19:15, Dmitry Stogov wrote: >=20 > "works" and "fits" are different.=20 Fair point. > Strict type hinting may help catching problems only at run-time. >=20 > In PHP you almost never can do something ahead of time, because of = run-time binding. > You may only guess, analyzing the whole projects and performing type = inference. This is true to an extent. However, there are still some things you can = catch ahead-of-time. One of the things strict mode caught could=E2=80=99ve= been noticed by a static analyser. The other probably wouldn=E2=80=99t = have been. Strict typing tends to be better for catching errors = ahead-of-time, and I think with return types it=E2=80=99ll get even = better. Thanks for your input. -- Andrea Faulds http://ajf.me/