Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78819 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54089 invoked from network); 6 Nov 2014 14:51:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 14:51:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.52 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.218.52 mail-oi0-f52.google.com Received: from [209.85.218.52] ([209.85.218.52:53979] helo=mail-oi0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/F6-28384-C0B8B545 for ; Thu, 06 Nov 2014 09:51:57 -0500 Received: by mail-oi0-f52.google.com with SMTP id u20so856207oif.11 for ; Thu, 06 Nov 2014 06:51:53 -0800 (PST) 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; bh=VilpPDHYIiAXzX5xJgoHkqqN4RhtTDUZoKAWx2x9N2U=; b=meZYArC+pnAfUPueA/U8mCtEHGxRaePGncW73Wrc2miigNlK4zhokK/JJIqu1197s0 RpBMzkbul3qdx7zmxEuM2QNgUNOJ0GIIATVFOWW/9w6T77cU1S63CZNDoRHNc8fFM65X 4IqDC73oxFKAymMq55j7TSca+TQqal7dBwG+DarVckKhSNxGAofN+LVmM17B5CFkaTcR AdRMghLaHjVEs4ppbttfXHx/afnGIrY/HgDkpaXddPYI8RRVsE6/r26X43vH1Y7gUlHC k0tP21t9jNsqHGiVUUjX2NqoS8LhKaxt7Pp3i2nOdxIAOScKB8qAsNbrIowhpZ/eEtXE u6CQ== MIME-Version: 1.0 X-Received: by 10.202.212.207 with SMTP id l198mr3925838oig.12.1415285513642; Thu, 06 Nov 2014 06:51:53 -0800 (PST) Received: by 10.76.159.163 with HTTP; Thu, 6 Nov 2014 06:51:53 -0800 (PST) In-Reply-To: References: <5B1B375C-328B-40BD-B715-8EDA158B44CE@ajf.me> <545A912A.2050202@sugarcrm.com> <545AA193.6060606@sugarcrm.com> <3E396F3F-CD59-4198-8FD2-1A8C4ED3B87A@ajf.me> <5BB43ECD-089D-4DDD-AD95-1263B05279CB@ajf.me> Date: Thu, 6 Nov 2014 07:51:53 -0700 Message-ID: To: Dmitry Stogov Cc: Andrea Faulds , Stas Malyshev , internals , Nikita Popov Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC][Vote] Return Types From: morrison.levi@gmail.com (Levi Morrison) On Thu, Nov 6, 2014 at 12:43 AM, Dmitry Stogov wrote: > It's clear, that covariant types are more smart, but not supporting them, > won't prevent access to more specific type properties and methods. > We are not C++ or Java, and we don't need to cast objects to more specific > types. > > On the other hand covariance requires all return types to be defined before > class binding. > It may be a serious new problem. For example you won't be able to compile > the following code at all? > > class A { > function foo(): C {} > } > class B extends A { > function foo(): C {} > } > class C extends B { > function foo(): C {} > } > ?> I think I have figured out away to do the type checks that would allow this and current checks to work; I'll report back after some trial and testing.