Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85096 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26483 invoked from network); 16 Mar 2015 22:01:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 22:01:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=padraic.brady@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=padraic.brady@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.176 as permitted sender) X-PHP-List-Original-Sender: padraic.brady@gmail.com X-Host-Fingerprint: 209.85.160.176 mail-yk0-f176.google.com Received: from [209.85.160.176] ([209.85.160.176:33547] helo=mail-yk0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/3E-34940-3D257055 for ; Mon, 16 Mar 2015 17:01:55 -0500 Received: by ykek76 with SMTP id k76so23295575yke.0 for ; Mon, 16 Mar 2015 15:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=GVlxLMd/0+siBYOMVWnsQvzyAZq/rUWuuH4nRha48Qc=; b=QoJ0ZnQrkmQPjpcKmY0drPitoHOnMYkHVUG5p4AhfZW45CUseIr+9UnhyoBNyHL1HG Ec7EjLhT4eMQehTY4Ao/8DxWCXaqzGAlO5x00D6hpbP9UmDR2YEHB74aV+Y1bLRkGh82 J97TD9uLtqCfpCsMuLWKKfmon26Jc7r+I+EpfrcFyGUrQeVX2sJomelIUu9/FyqDlfH2 j9cktZ1jrXrY3HgR+1Fd+oZlZVz23FErYjN26+UE+eG635Cwm+p0JedIQp7iwdlixG+g TUs/+F54uQ7fMFqvSsK9M8fsNUaU51qLLtXEC7yv4pttm1W7KyEEyHr2pT6B7CP97cN4 7A5A== MIME-Version: 1.0 X-Received: by 10.236.50.138 with SMTP id z10mr55774816yhb.2.1426543312375; Mon, 16 Mar 2015 15:01:52 -0700 (PDT) Received: by 10.170.222.86 with HTTP; Mon, 16 Mar 2015 15:01:52 -0700 (PDT) In-Reply-To: References: <55033D61.8050405@lsces.co.uk> Date: Mon, 16 Mar 2015 22:01:52 +0000 Message-ID: To: Thomas Punt Cc: David Muir , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] STH and the 3 RFCs From: padraic.brady@gmail.com (=?UTF-8?Q?P=C3=A1draic_Brady?=) Hi Thomas, On 16 March 2015 at 20:51, Thomas Punt wrote: > >> No, your example would blow up regardless of the caller being in strict = mode or weak mode. > > That was the point in my hypothetical example - the library can decide > what mode it wants the user to use (strict or weak) if it wants to. Sticking with that as a theory... function foo ($i) { if(!is_int($i)) { throw ToysOutOfPramException('I need an integer!'); } } We can already do this. Indeed, we do do this. Yes, it *might* be seen as a dick move employing any sort of trick to push strict type hints specifically, but being explicit is quite acceptable. I have code stuffed full of those gems and deployed =3D=3D=3D checks. So while I appreciate it looks bad, it's nothing all that new to find people taking steps to enforce a strict view of acceptable values. There's a reason why type hints, in some form, have support from the community. Paddy -- P=C3=A1draic Brady http://blog.astrumfutura.com http://www.survivethedeepend.com