Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29470 invoked from network); 3 Feb 2015 16:14:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2015 16:14:58 -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:50149] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/92-20608-104F0D45 for ; Tue, 03 Feb 2015 11:14:58 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 6FAFB8800E6; Tue, 3 Feb 2015 11:14:54 -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 b3F3kzGnZzuG; Tue, 3 Feb 2015 11:14:54 -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 3052A8800A2; Tue, 3 Feb 2015 11:14:52 -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: Tue, 3 Feb 2015 16:14:50 +0000 Cc: Arvids Godjuks , PHP Internals , Nikita Popov Content-Transfer-Encoding: quoted-printable Message-ID: <5E952833-7651-40A5-B88C-1701B100F150@ajf.me> References: 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 Dmitry, > On 3 Feb 2015, at 04:07, Dmitry Stogov wrote: >=20 > I have similar opinion. Strict typing looks foreign for PHP. It is in a way, yes. PHP has traditionally been =E2=80=9Cweakly-typed=E2=80= =9D everywhere. That being said, we=E2=80=99re not always weakly-typed (there are strict = type checks in some places), and userland code has sometimes done strict = type checks anyway. > I see, strict type hints may be useful. > Aspecially for testing and error detection, but anyaway, I'm not sure = if and how it should be enabled. Declare() is a working solution, but = it's not excelent. It=E2=80=99s not a perfect solution, but I haven=E2=80=99t seen anything = that seems to be much better. The best bit about declare() is that it = would make strict types completely optional, so people who don=E2=80=99t = like them wouldn=E2=80=99t have to use them, even if they call code = which does. -- Andrea Faulds http://ajf.me/