Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81631 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13102 invoked from network); 2 Feb 2015 19:12:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 19:12:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; 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:52913] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/60-34915-A2CCFC45 for ; Mon, 02 Feb 2015 14:12:43 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 216832400D6; Mon, 2 Feb 2015 14:12:40 -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 a_h65_Mt4q9J; Mon, 2 Feb 2015 14:12:40 -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 5C5632400A9; Mon, 2 Feb 2015 14:12:39 -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: Mon, 2 Feb 2015 19:12:36 +0000 Cc: PHP Internals List Content-Transfer-Encoding: quoted-printable Message-ID: <2AABD912-C2A3-4877-8B40-8E391B2BE45F@ajf.me> References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <1E54E93F-8CE1-469F-BE1F-DD2F1DF76E39@ajf.me> <5175DE01-ADC9-4A0B-8343-820C53B30054@ajf.me> To: Dmitry Stogov X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: ajf@ajf.me (Andrea Faulds) Hi Dmitry, > On 2 Feb 2015, at 18:22, Dmitry Stogov wrote: >=20 > So, one of the advantages of strict type hinting is the ability to = catch potential errors. > For example when we pass 67 to setBody(string $message). Yes, that sort of thing is easily caught by strict type checks. = They=E2=80=99re also able to catch things that are sometimes okay for = weak hints, sometimes not. For example, some *but not all* strings are = accepted for integer and float parameters, and some *but not all* floats = are accepted for integer parameters. Strict checks make this much = simpler and not dependant on the value: either some type is accepted, or = it isn=E2=80=99t. Because of that, strict types can actually be effectively analysed = ahead-of-time by static analysers, IDEs and so on, and so you can catch = some types of errors while editing your code, without even needing to = run it. This is quite a powerful feature. Nikita might have more to say = on that. Thanks. -- Andrea Faulds http://ajf.me/