Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80559 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1174 invoked from network); 15 Jan 2015 15:58:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 15:58:12 -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:58081] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/BE-14306-99ED7B45 for ; Thu, 15 Jan 2015 10:36:57 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 66F792400D6; Thu, 15 Jan 2015 10:36:54 -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 POBIx4IQLTPQ; Thu, 15 Jan 2015 10:36: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 BFC3F2400C3; Thu, 15 Jan 2015 10:36:52 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Thu, 15 Jan 2015 15:36:50 +0000 Cc: Jordi Boggiano , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <54B7D8AE.5090209@seld.be> To: =?utf-8?Q?Pavel_Kou=C5=99il?= X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: ajf@ajf.me (Andrea Faulds) Hi Pavel, > On 15 Jan 2015, at 15:25, Pavel Kou=C5=99il = wrote: >=20 > On Thu, Jan 15, 2015 at 4:11 PM, Jordi Boggiano = wrote: >>=20 >> Reading the thread at this point shows so much confusion, it seems = half the >> people reading the spec misunderstood that the declare() line affects >> function calls only and not the API/implementation level. >=20 > Yeah, while the confusion is definitely still there, I would > personally argue that definitely some people who oppose the declare() > get that it's only for calls in the file - and still don't find it > clever. >=20 > The potential issues with this are pretty real, to be honest. Simple > things like moving a method from one class to another (let's say to > parent or descendant) and getting to another typing context may cause > unpredictable behavior if the user forgets to have declare() in both > files. This is true, you would sometimes have problems if you=E2=80=99re mixing = the strict and weak type checking modes in your codebase. The intention is that you=E2=80=99d use one or the other exclusively, = perhaps with some minor exceptions as and where necessary. The fact = it=E2=80=99s weak by default means you could add scalar type hints = gradually without breaking things, because the weak mode is quite = permissive. Then, if you wanted to, you could gradually migrate each = file in your codebase over to strict mode. Essentially, you get =E2=80=9Cgradual typing=E2=80=9D like Hack, but = without Hack=E2=80=99s approach which I don=E2=80=99t particularly like. = Hack=E2=80=99s approach is to simply not enforce type hints if they=E2=80=99= re a problem. On the other hand, this RFC would alway enforces them, but = the weak mode is less strict. So, I anticipate that while it would cause problems during a transition, = I think codebases would end up using one mode or the other exclusively = and wouldn=E2=80=99t have problems once they had done so. Thanks. -- Andrea Faulds http://ajf.me/