Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81668 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82236 invoked from network); 2 Feb 2015 22:51:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 22:51:42 -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.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:53388] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/DB-25089-D7FFFC45 for ; Mon, 02 Feb 2015 17:51:41 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id AAD9B8800ED; Mon, 2 Feb 2015 17:51:38 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DH6EjF6eoHXv; Mon, 2 Feb 2015 17:51:38 -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 F27C18800E5; Mon, 2 Feb 2015 17:51:36 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: <54CFFC5D.4000802@gmx.de> Date: Mon, 2 Feb 2015 22:51:34 +0000 Cc: Thomas Bley , Dmitry Stogov , nikita.ppv@gmail.com, internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <619EAE9D-615B-409D-AB8C-E64B2B113A6E@ajf.me> References: <20150202210349.6FB91261948@dd15934.kasserver.com> <54CFE965.2080905@gmx.de> <20150202214254.BEB88261948@dd15934.kasserver.com> <54CFFC5D.4000802@gmx.de> To: Christoph Becker 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 Christoph, > On 2 Feb 2015, at 22:38, Christoph Becker wrote: >=20 > And frankly, I don't see what's wrong with a weak type hint in this = case: >=20 > function addVat(float $amount) {...} >=20 > You're returning a float, anyway. Given you=E2=80=99re dealing with currency, and given the fairly serious = issues with precision loss with int->float conversions and vice-versa=E2=80= =A6 I would be highly concerned if you used a weak type hint there. > OTOH, strict type hints would require a lot of manual conversions. Sure, they do. But they=E2=80=99re *explicit* manual conversions, ones = you can easily grep for and that are obvious when reading code. -- Andrea Faulds http://ajf.me/