Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78760 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29505 invoked from network); 6 Nov 2014 00:26:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 00:26:36 -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.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:44425] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/10-28384-B30CA545 for ; Wed, 05 Nov 2014 19:26:35 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id D3104B000A0; Wed, 5 Nov 2014 19:26:31 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uEFwZxBO7-Vo; Wed, 5 Nov 2014 19:26:31 -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 4B1C7B0009D; Wed, 5 Nov 2014 19:26:29 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: <545AA193.6060606@sugarcrm.com> Date: Thu, 6 Nov 2014 00:26:26 +0000 Cc: Dmitry Stogov , Levi Morrison , internals , Nikita Popov Content-Transfer-Encoding: quoted-printable Message-ID: <3E396F3F-CD59-4198-8FD2-1A8C4ED3B87A@ajf.me> References: <5B1B375C-328B-40BD-B715-8EDA158B44CE@ajf.me> <545A912A.2050202@sugarcrm.com> <545AA193.6060606@sugarcrm.com> 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 5 Nov 2014, at 22:15, Stas Malyshev wrote: >=20 > Hi! >=20 >> No, classes are not loaded for type checks, since it would be = pointless >> - if the class is not loaded, you could not have a value of that = type, >> so if the class is not present, the answer is "no". >>=20 >>=20 >> It's not true anymore, with this proposal. >=20 > This is not good. The base premise of type checks always was if you > don't use them, they are basically free - you don't load the classes, > you don't do any work, until you actually need them, and by then your > class is supposed to be already loaded, so again it's not costly. But = if > just declaring a type could trigger loading of code, this may > significantly increase the footprint and loading time for classes that > have many options but only use some of them at the time. It shouldn=E2=80=99t need to load any code normally, it=E2=80=99s only = if an inheriting class changes the type. > 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 Yeah, we should probably have arguments be contravariant or covariant. 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. -- Andrea Faulds http://ajf.me/