Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80598 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90482 invoked from network); 15 Jan 2015 22:12:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 22:12:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:42811] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/95-61348-33B38B45 for ; Thu, 15 Jan 2015 17:12:03 -0500 Received: by mail-wi0-f173.google.com with SMTP id hi2so419058wib.0 for ; Thu, 15 Jan 2015 14:11:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to :message-id; bh=U2mqoHRuJkLjVYnhweVKVez8kXEcMvQNuKXH9RVTMoU=; b=f1nkl3uPyL5o6+ib1OaoosiRpx4BltXd2GDuAp6MWMBmqYt0ZWR08U51T0kdOreAdi fSn0jrz9/4MN4tTcQMyOUIuvllFg4uZFApB/OLvXvCmOGUTN7k1RGcKKlu9Tv8FCLCZP ea3FbDr2rFVt1DrHIqJ+edWbVVMPeSVECj1tlVrrf87DgSZ44PeO+pL8t+PBiMxEP7Ny ov9gDDKOloj4JobKwlpd4PEPMmbT8gQhFHBV7nDwBe78Oso35xkKvW0wOoMwcVlSN3HG KIV3EmkRkwcjKe9jRZ6vCVggo/ad4ufJiVhb2GGVCol6e6jea+cV1f1fVxA0lomItzyV zlBw== X-Received: by 10.180.20.106 with SMTP id m10mr173339wie.1.1421359918556; Thu, 15 Jan 2015 14:11:58 -0800 (PST) Received: from [192.168.0.3] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id u9sm3674985wjy.37.2015.01.15.14.11.57 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 14:11:57 -0800 (PST) User-Agent: K-9 Mail for Android In-Reply-To: <20150115201654.4674326139A@dd15934.kasserver.com> References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <4E2073DE-0951-498C-97BB-DDAC094F11FA@ajf.me> <9a033dd1f223f854e760924d118ab812@mail.gmail.com> <2ae0164cb9b9bf1c974d7a3c60af0466@mail.gmail.com> <6105ea99002e634373c09685310e26a6@mail.gmail.com> <8BABA306-12CE-4568-98F3-419A1557F61B@ajf.me> <20150115201654.4674326139A@dd15934.kasserver.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Thu, 15 Jan 2015 22:09:54 +0000 To: internals@lists.php.net Message-ID: <395C69A3-3305-43DF-87D5-128D977EA3ED@gmail.com> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: rowan.collins@gmail.com (Rowan Collins) On 15 January 2015 20:16:54 GMT, Thomas Bley wrote: >What about doing both weak and strict with two different syntaxes? > >public function __construct(string $name, $age as int, $cuteness as >float, bool $evil) { > >string $name // strict >$age as int // weak >$cuteness as float // weak >bool $evil // strict > >"as" Syntax is taken from SQL92. > >Regards >Thomas This is what some are proposing, but with slightly different syntax choices, inspired by existing cast operators: public function __construct(string $name, (int) $age, (float) $cuteness, bool $evil) Like literally every proposal in this area, some people think it's The Solution, others absolutely hate it. Andrea has stated (if I'm not paraphrasing too badly) that a major reason for putting the caller in control, not the definer, is that it's easier to reason about code where all the calls you are looking at follow one behaviour, regardless of where they were defined.