Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78762 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33655 invoked from network); 6 Nov 2014 00:57:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 00:57:34 -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:40485] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/C0-28384-C77CA545 for ; Wed, 05 Nov 2014 19:57:33 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 8BE1D2400DE; Wed, 5 Nov 2014 19:57:29 -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 W-B-d9BTRnOP; Wed, 5 Nov 2014 19:57:29 -0500 (EST) Received: from oa-res-26-28.wireless.abdn.ac.uk (oa-res-26-28.wireless.abdn.ac.uk [137.50.26.28]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 20CE52400D6; Wed, 5 Nov 2014 19:57:27 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: <3E396F3F-CD59-4198-8FD2-1A8C4ED3B87A@ajf.me> Date: Thu, 6 Nov 2014 00:57:25 +0000 Cc: Dmitry Stogov , Levi Morrison , internals , Nikita Popov Content-Transfer-Encoding: quoted-printable Message-ID: <5BB43ECD-089D-4DDD-AD95-1263B05279CB@ajf.me> References: <5B1B375C-328B-40BD-B715-8EDA158B44CE@ajf.me> <545A912A.2050202@sugarcrm.com> <545AA193.6060606@sugarcrm.com> <3E396F3F-CD59-4198-8FD2-1A8C4ED3B87A@ajf.me> To: Stas Malyshev X-Mailer: Apple Mail (2.1990.1) Subject: Re: [PHP-DEV] [RFC][Vote] Return Types From: ajf@ajf.me (Andrea Faulds) > On 6 Nov 2014, at 00:26, Andrea Faulds wrote: >=20 >> Also, it is kind of weird that arguments require exact match but = return >> types do not. Not that we care for consistency anymore=E2=80=A6 >=20 > Yeah, we should probably have arguments be contravariant or covariant. >=20 > I was going to argue that covariance is important, but now that I = think about it, the most important case is just self. If I can have = Foo::foo() return a Foo and Bar::foo() return a Bar, with Bar inheriting = from Foo, and this not breaking the invariant type check, I=E2=80=99m = happy. What I meant there wasn=E2=80=99t `self`, but actually `static`, I = think, which sadly this RFC doesn=E2=80=99t provide. I think that=E2=80=99= d be a very useful feature. If we can=E2=80=99t get covariant returns = and must go for invariants, I think we=E2=80=99d have to have `static` = supported. I note that Hack also has invariant parameters and covariant return = types. There=E2=80=99s probably some good reasoning behind that, I think = it=E2=80=99d be worth asking some HHVM people about why that decision = was taken, they might provide some useful insight. -- Andrea Faulds http://ajf.me/