Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81957 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51855 invoked from network); 5 Feb 2015 18:53:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 18:53:27 -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:34108] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/B8-27691-72CB3D45 for ; Thu, 05 Feb 2015 13:53:27 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id F0D27888E81; Thu, 5 Feb 2015 13:53:24 -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 jnVgn8k3GSUz; Thu, 5 Feb 2015 13:53:24 -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 593A7888E85; Thu, 5 Feb 2015 13:53:22 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: <01a501d04121$e0b81130$a2283390$@tekwire.net> Date: Thu, 5 Feb 2015 18:53:20 +0000 Cc: Stanislav Malyshev , Andrey Andreev , Sebastian Bergmann , internals@lists.php.net 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> <54D2C018.6050803@gmail.com> <01a501d04121$e0b81130$a2283390$@tekwire.net> To: francois@tekwire.net 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 Fran=C3=A7ois, > On 5 Feb 2015, at 08:58, Fran=C3=A7ois Laupretre = wrote: >=20 > +1. Checking IS_ at the C level after implicit conversions and = checking this at the PHP level are very different. >=20 > IMHO, the key point is the concept of 'type'. Strict typing considers = a one-to-one correspondence between PHP types and zval types, which is = nonsense. At the PHP level, any value returning true through = is_numeric() IS a 'number', and it must remain so. Any such value with a = null decimal part is an 'integer' (not the result of 'is_int()') and so = on. This simply isn=E2=80=99t how PHP works. PHP has a limited form of type = juggling, but the types of values are not merely an implementation = detail. There are numerous places where PHP completely violates the = notion that these types don=E2=80=99t matter, such as comparisons, = sorting, functions accepting multiple types, functions returning = multiple types, bitwise operators and array indexing. All of these = discriminate between types. To claim that types are merely an aspect of = a zval is ignorance in the extreme. -- Andrea Faulds http://ajf.me/