Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105643 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31404 invoked from network); 8 May 2019 19:23:18 -0000 Received: from unknown (HELO mail-vk1-f195.google.com) (209.85.221.195) by pb1.pair.com with SMTP; 8 May 2019 19:23:18 -0000 Received: by mail-vk1-f195.google.com with SMTP id d74so5111421vka.3 for ; Wed, 08 May 2019 09:27:29 -0700 (PDT) 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:reply-to :from:date:message-id:subject:to:cc; bh=BixNOI4Cqq8G/NjWsjdUnukMRVarZxa8fAgrK3fasS4=; b=bQjY1Nkq4Zi/tB58o7ZJ8E3sqrZyzOt9/CSVBQWwz6gCIVjxzu+TjYgqqFN+s8LaG6 dHud5mp/hxipSSdR7xW+8V3gUdkC8mVD/nnEKP9a8L/ZdCXfYbratVPazyNWtITUrW1V KB/2GYoqsXNTVVgh5Rhly63LHoQmPOvYnSHI9GQFEV8qSzzcQ9T/puCCH9+v+YXkb9pY juHNDSan1t+mzU6WKDL19wWJBeTzIs7ufhyQPgZ/C6a9CHYgVEoKMjz7TRDKMugXsJPM bDmANYrF5qBKFqlr9zztG6cE8EXgQcrlQ69kUgzygYzBk0JMI9qAJWSR/Rvj2sUqXfBD YDmQ== X-Gm-Message-State: APjAAAXxrBlK2qoks1ZLwjxY9NMM9s9a+Xiyb64OowIt+NTK0MGyV2FH /RiHKMWN2dyZIeXElIWhYzh2CSWU++XHiTbUprE= X-Google-Smtp-Source: APXvYqwhW7ruFWIK/hs++hHQUCXqgvgkMx/BX+bpuKc4guNqy6L3eR/Q9vCh+FHbR3US6+NGf4y8DeGngoj77ojRVmQ= X-Received: by 2002:a1f:62c7:: with SMTP id w190mr16232386vkb.72.1557332848603; Wed, 08 May 2019 09:27:28 -0700 (PDT) MIME-Version: 1.0 References: <8094526f-88d6-6d46-6f83-4165d65c064a@gmx.de> In-Reply-To: Reply-To: bishop@php.net Date: Wed, 8 May 2019 12:27:04 -0400 Message-ID: To: Nikita Popov Cc: internals Content-Type: multipart/alternative; boundary="0000000000003cf783058862cf61" Subject: Re: [PHP-DEV] Re: [RFC][Vote] Covariant Returns and Contravariant Parameters From: bishop@php.net (Bishop Bettini) --0000000000003cf783058862cf61 Content-Type: text/plain; charset="UTF-8" On Wed, May 8, 2019 at 4:06 AM Nikita Popov wrote: > 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? > As I read it, the RFC [1] aims to address the variance problem. The declaration problem is related - but separate. Seems to me, solving the variance problem is the primary concern. Since declarations are therefore a secondary concern, I agree with the separation. (More the so because, IMO, it's better to solve a problem holistically.) [1]: https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters --0000000000003cf783058862cf61--