Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81609 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72065 invoked from network); 2 Feb 2015 16:50:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 16:50:54 -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.208 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.208 imap2-3.ox.privateemail.com Received: from [192.64.116.208] ([192.64.116.208:52359] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/E7-34915-CEAAFC45 for ; Mon, 02 Feb 2015 11:50:54 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 775C68C0080; Mon, 2 Feb 2015 11:50:50 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xlN95y20--Ax; Mon, 2 Feb 2015 11:50:50 -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 002CE8C0081; Mon, 2 Feb 2015 11:50:49 -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 16:50:47 +0000 Cc: PHP Internals List Content-Transfer-Encoding: quoted-printable Message-ID: References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> To: Matthew Leverton X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: ajf@ajf.me (Andrea Faulds) Hi Matthew, > On 2 Feb 2015, at 16:45, Matthew Leverton wrote: >=20 > On Sun, Feb 1, 2015 at 5:49 PM, Andrea Faulds wrote: >> Good evening, >>=20 >> The RFC has been updated to cover return types, since Levi=E2=80=99s = Return Types RFC has passed. The patch is a work in progress: it works, = but lacks tests for return types. >>=20 >> Version 0.3 of the RFC can be found here: = https://wiki.php.net/rfc/scalar_type_hints >>=20 > After thinking and talking this over, I do think your RFC is the only > option that makes sense *if* you want to support both weak and strict. > However, I think the usage of declare() makes it dead in the water. > Fair or not, I have a hard time looking past that. Ah, that=E2=80=99s unfortunate. I know declare() is ugly and a little = unwieldy, but I can=E2=80=99t see another way to do it which doesn=E2=80=99= t cause bigger problems. I am convinced that if this RFC passed, people = would probably get used to declare(). IDEs and command-line tools do = exist. > I'm opposed to other compromises because I think it will be a big mess > from the caller's perspective. (Some functions would be strict, some > would not ... eventually forcing everybody to just use strict types.) > And, as I've stated previously, I prefer strict types. That=E2=80=99s how I feel as well. > Does the implementation of strict-only work for testing right now? (If > so, what branch is it on, etc?) It's easy for everybody to theorize > about how this would work, but why not actually take the time to > "strictify" some part of a commonly used library and see how it > actually works in practice? But a library with type-hints + a script > to prepend "use strict" to every PHP file would make testing impact on > real-world usage easy for anybody. The implementation does work for testing. I still need to write tests = for return types but they seem to work. Parameter types are = fully-working, though, and they have extensive tests, so I know = they=E2=80=99re working fine and you could add them to an existing = project. Strictifying an existing library is a good idea. I=E2=80=99ll try = =E2=80=9Cstrictifying=E2=80=9D one of my bigger personal projects = (PictoSwap, a 3DS browser application with a PHP backend) and see how it = goes. I expect it=E2=80=99ll be fairly smooth, we=E2=80=99ll see. Thanks for your thoughts. -- Andrea Faulds http://ajf.me/