Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98294 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49660 invoked from network); 14 Feb 2017 21:20:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2017 21:20:08 -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.215.46 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.46 mail-lf0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:34617] helo=mail-lf0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/06-23443-68473A85 for ; Tue, 14 Feb 2017 16:20:07 -0500 Received: by mail-lf0-f46.google.com with SMTP id v186so72525829lfa.1 for ; Tue, 14 Feb 2017 13:20:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=paijDjTLnH2F4h2BuDwzUkCmwRI5E7tNvGhAWx7/GeI=; b=WILcfvtuZ9XF0reYG2Z57+7p3O3UTn/hHUvykad981+zwN7F0PcskRauH2elVDkzfC xIAi/vQmMBA+lBLG1kSdIEaGtXbg3s0J2Eenh5QA+8kPprRaq7ITStZGEBXq+wTaRkT0 u+eYSi3ncaWxKuHt/mD2ls++FItXxGqYvjzi93jHSrX7swcCB046W3TV0swcyOXmMceX 1cao0P5DNr8y3RQn/yv4nD3xWhnim+8yCOkByiYm+ghk+6AtiW35NMgEy9aLagfHMYh0 3rPZakU7sLpBCAeJotkDTkA6sz337N1P6g/rvTEcKr13sQ5yxL+T1AcsxGKB6jcPOxv4 886A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=paijDjTLnH2F4h2BuDwzUkCmwRI5E7tNvGhAWx7/GeI=; b=QJxyHkTjH0NB2ChGUPTRlPi3ytkK7oDntCQJLtm9sCzB3bUwre0OjSudBo63wSspsW sRWjTKBsvh8Qy3sjLZ1uMZt/QtgJMgI3YGiybgydw+ic6TazNptoyEacQl3a7IU3c/I7 IroclZ6o0DZITiSIUhR17gSpOSenrMr/DeJY6cro5XSxUn8WwFMi/O7KryMD7NYwQaHD PRk4vjToK33/TYoSLITwsGzHMiVp59gk+oNkqDBHs9nu57gl3BiTOCdqYrVNJ1YOD/a4 Q7ybSrf3dux8Nr+WyDYE1ux2qCUCS/MMqCratyGFI2c4xZEV4ktRaEniHKOkN5AQL8mM EK9A== X-Gm-Message-State: AMke39mNaIaw1UeupgO6glth+WwSXEwhANe0u98OCQ22L5l9t3r9AVonBv0JtvmS5Y4MuMNXZYynim/fH7Fq5w== X-Received: by 10.25.89.148 with SMTP id n142mr8419911lfb.64.1487107203218; Tue, 14 Feb 2017 13:20:03 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.25.151.139 with HTTP; Tue, 14 Feb 2017 13:20:02 -0800 (PST) In-Reply-To: References: Date: Tue, 14 Feb 2017 14:20:02 -0700 X-Google-Sender-Auth: VlDDJ0rN7vD6AWOZekOv0kEDiP4 Message-ID: To: Dan Ackroyd Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object type hint, now with added variance From: levim@php.net (Levi Morrison) On Tue, Feb 14, 2017 at 2:14 PM, Levi Morrison wrote: > On Tue, Feb 14, 2017 at 11:55 AM, Dan Ackroyd wr= ote: >> Hi Levi, >> >> On 24 November 2016 at 08:58, Dan Ackroyd wrote= : >>> Hi Levi, >>> >>> On 23 November 2016 at 01:25, Levi Morrison wrote: >>> >>>> For instance enumerations (or enums) are one possible type I can see u= s >>>> adding that may not be objects. >>> >>> I very much look forward to the RFC for enums, and have for some time. >>> When are you thinking of submitting it for discussion and voting? >> >> I can understand your concerns. At the same time, I hope you can >> understand that people won't want to put off introducing features that >> they want in the meantime. >> >> I think if you were able to give a timeline for when an Enum RFC could >> be introduced, before the PHP 7.2 release, we could talk about whether >> it would be right to hold off on this RFC for now. >> >> Otherwise I suggest Micha=C5=82 updates the voting options, and we open = the >> voting in a week or so. >> >> cheers >> Dan > > Let me clarify that I'm not against this object variance; there is > nothing intrinsic about object variance that prevents enums (or > typedefs/type aliases). Rather it's *how* it is achieving that > variance that is an issue. This is something that should ship along > with full covariance/contravariance and not be a special case which > may unintended side-effects later (such as preventing enums without > breaking BC). Does that make sense? Here's a concrete compatibility concern. Let's assume we have the following code: interface Factory { function make(...$args): object; } class FooFactory { function make(...$args): Foo; } Currently the engine would not have to know anything about Foo to know if it is a sub-type of object. It would not need to require it to even be defined. However, if at some point in the future we add non-object types it may now error or autoload. The way to avoid the compatibility concern is to implement this feature the same way we wold implement full covariance, which would similarly need to know about the types involved. Does that make more sense as to why the assumption that unknown types are object types is an issue?