Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105640 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 810 invoked from network); 8 May 2019 11:02:03 -0000 Received: from unknown (HELO mail-lj1-f195.google.com) (209.85.208.195) by pb1.pair.com with SMTP; 8 May 2019 11:02:03 -0000 Received: by mail-lj1-f195.google.com with SMTP id s7so11222876ljh.1 for ; Wed, 08 May 2019 01:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rvI50CzNHWYtIffoT8qHkRCTofY87Fntfo/0Zn+Ob54=; b=lWykDqbAHNxfE4obAlXeYXChkvAKveQMz17jusGWsZHrfuRZLXySmJ3jFG0jztBj1i fkJ/Wra3DcjhISaNf+/XxcZzEqXUC90DwB5jLUkmw/ARHYgceBJw5Ojap2nsMhcOARTq 29C8MGURlS+07p0oIij/p5bxUodIrjVxryfBcYvAXu+as70uaaJv3B8S7RcW3QWkPReU a+LZayil38x5MDgEYruI4mW4mDOJsYLj5QEz2U1x3XQN7T9xBIcVAfm3bYITxr93JGDY tO5IdaC7qK8fe8wiDUkFRhNLCcKLzGnYKKTwBvZQVR7sBK8SXWlpNfMks+Xwkb7/R+/M f2Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rvI50CzNHWYtIffoT8qHkRCTofY87Fntfo/0Zn+Ob54=; b=K0SH/ElMKje8zQ6Wetnm3dnt3OPPLvqq0vHsimTW3Q4AJoI6iZ2gaBUUrHFMUCfhO9 4LYES4vRujsmSLGXaAcntX/tQfQdibLj7LdZLfPw0MCBGq/unheVv628E+maNNez+98x zC/ZLYF9/wWqItpUEE8DmjEnwea055Hsdk0gPTvRoEsJr5ckliEVdLJUpTGhP38scJHx /Hurkk2iyISr1v9qVJMP/uu2BMSaGSrmSnU0BknqIT5sempXrhxES6xFxAbCxDClSyeh 884wYGixgsl5JltBsOheV4tJJEK3dbENbeqI2HX2nzvKkfZBgkgzzhv/JQYurYv1CGrD D0DA== X-Gm-Message-State: APjAAAVqeO0Reo6AEd/aEMGBavwQ2d9DMACyy/L0FWDNMKgdFtnZrn+F 7rQT0XcxxNBgHypfwBdRbMqJ9bSkHXUOmbZrUV0= X-Google-Smtp-Source: APXvYqwevDYBhEVEguiW2lctiN0qJm1Xmhah+pArrxGLrHQOArgF+2WwU37QHEaswU6We1WLuh8kaMqYCOuH2VIkel0= X-Received: by 2002:a2e:5517:: with SMTP id j23mr4213050ljb.5.1557302767941; Wed, 08 May 2019 01:06:07 -0700 (PDT) MIME-Version: 1.0 References: <8094526f-88d6-6d46-6f83-4165d65c064a@gmx.de> In-Reply-To: Date: Wed, 8 May 2019 10:05:51 +0200 Message-ID: To: Levi Morrison Cc: "Christoph M. Becker" , internals Content-Type: multipart/alternative; boundary="0000000000004a7c4205885bce93" Subject: Re: [PHP-DEV] Re: [RFC][Vote] Covariant Returns and Contravariant Parameters From: nikita.ppv@gmail.com (Nikita Popov) --0000000000004a7c4205885bce93 Content-Type: text/plain; charset="UTF-8" On Tue, Jan 22, 2019 at 6:59 PM Levi Morrison wrote: > On Tue, Jan 15, 2019 at 1:27 PM Christoph M. Becker > wrote: > > > > On 04.01.2019 at 20:17, Levi Morrison wrote: > > > > > I intend to close the vote in a day or two, unless I hear of new> > issues from Dmitry or others. > > Any news here? > > > > -- > > Christoph M. Becker > > I sent this a week ago to Christoph only; oops. > > I have not heard any news. The vote is now closed. The RFC passes 39 > in favor to 1 against. > > Special thanks to Nikita and Dmitry who have helped find issues and > review the patch. It will not be merged until the implementation > quality is satisfactory. > As we're moving steadily towards 7.4 feature freeze, I'd like to discuss what we want to do with this RFC... The current implementation doesn't work correctly (I've done some more work in https://github.com/nikic/php-src/commits/variance-7.4, but it's also incomplete) and I have some doubts about how we're approaching this in general. This RFC really has two parts: 1. The actual variance change. This is a very straightforward change and there are no issues here. 2. The ability to check variance across multiple consecutive class definitions. This allows type declarations to reference classes that are declared later in the same file (but within one "block" of declarations). The second part is technically more dicey and somewhat arbitrary when seen in the wider scope of how class hoisting and early binding work in PHP: While PHP supports declaring classes "out of order" in some very simple cases like this... class B extends A {} class A {} ...it will not work for anything more involved than that, for example class C extends B {} class B extends A {} class A {} will already generate a "class not found" error. Now the variance RFC tackles one very specific part of this long-standing issue: The types referenced in parameter and return types may be declared later in the file (even if used variantly), but all other uses of the types still need to respect the declaration order. I think that we should be separating these two issues (variance and declaration order), and land the simple variance support in 7.4, while tackling the declaration order problem *in full* separately (in PHP 8, because I think we may want to make some BC breaking changes, in particular by making the class hoisting unconditional.) Thoughts on this approach? Nikita --0000000000004a7c4205885bce93--