Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80599 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92496 invoked from network); 15 Jan 2015 22:25:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 22:25:46 -0000 Authentication-Results: pb1.pair.com header.from=mails@thomasbley.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mails@thomasbley.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain thomasbley.de from 85.13.137.24 cause and error) X-PHP-List-Original-Sender: mails@thomasbley.de X-Host-Fingerprint: 85.13.137.24 dd15934.kasserver.com Received: from [85.13.137.24] ([85.13.137.24:58294] helo=dd15934.kasserver.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/F5-61348-76E38B45 for ; Thu, 15 Jan 2015 17:25:44 -0500 Received: from dd15934.kasserver.com (dd0803.kasserver.com [85.13.146.34]) by dd15934.kasserver.com (Postfix) with ESMTPSA id 794A226139A; Thu, 15 Jan 2015 23:25:40 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-SenderIP: 178.19.222.74 User-Agent: ALL-INKL Webmail 2.11 In-Reply-To: <395C69A3-3305-43DF-87D5-128D977EA3ED@gmail.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><395C69A3-3305-43DF-87D5-128D977EA3ED@gmail.com> To: internals@lists.php.net, rowan.collins@gmail.com Message-ID: <20150115222540.794A226139A@dd15934.kasserver.com> Date: Thu, 15 Jan 2015 23:25:40 +0100 (CET) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: mails@thomasbley.de ("Thomas Bley") I think the problem with the current rfc is: test(42); function test(string $a) does test((string)$a); function test(array $a) does not test((array)$a); although casting would be possible. So for consistency we might change the syntax or adapt array/object type hints with casting (BC-break). Regards Thomas Rowan Collins wrote on 15.01.2015 23:09: > 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. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >