Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103589 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76453 invoked from network); 12 Dec 2018 00:07:50 -0000 Received: from unknown (HELO mail-lf1-f53.google.com) (209.85.167.53) by pb1.pair.com with SMTP; 12 Dec 2018 00:07:50 -0000 Received: by mail-lf1-f53.google.com with SMTP id e26so11802008lfc.2 for ; Tue, 11 Dec 2018 12:35:03 -0800 (PST) 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; bh=p58JVnpq1lv2ZG1S0//kf/wc9Rt6W2BwKoNF7upEl+M=; b=Au/diT7HVX4+qqj+62DwVvqOOLuZb4EKBTtS8B7nBztDUKDNQaeGOEG4BksKOx/O1L PozlSgHymoTwwGEVyM6y0N2mwlG/chTyVee3GfoOzC4GzxF7IOGtgE8oTwxP2KaGPjQd BZxEVdsgtYeFpg1tCBpd77KArL3LPU5c/QrYat1X0U0KSEibYgQvrEtWDDQigAsURtS8 TCsnckid9EAvFzuL8gHKY7jcxKp8xKRjhdaOzRfRtbQx3VNkY25q5NBLwp4rBB4vAO0m aFgof7uq9Pl7UqJVGQQp5UjJw2TjHZddzQSJbhjEgHW5tFNCR83ct8GueMKnN1QfqqpL 8H5g== X-Gm-Message-State: AA+aEWZFzn9umqWMi4g+PXaYje2BmxaBleLkxcyzXVTzyqBfv+fBd55+ adenHhnxbcV3N8SH5w5rpJIvz9Zvf7MXIvG5XQNLtw== X-Google-Smtp-Source: AFSGD/Ut2gYexYSZeKwvP1nO3Bn7vH5ogt/Xb69LkvoA0NcOV5XJtyudeSckwJFDn5w3K/aTcc3OCaUC+mSwKYNwi8A= X-Received: by 2002:a19:e01e:: with SMTP id x30mr9786377lfg.89.1544560499867; Tue, 11 Dec 2018 12:34:59 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 11 Dec 2018 13:34:43 -0700 Message-ID: To: internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [RFC][Discuss] Covariant return- and contravariant parameter- types From: levim@php.net (Levi Morrison) On Mon, Nov 26, 2018 at 2:25 PM Levi Morrison wrote: > > I am happy to announce my latest RFC, [Covariant Returns and > Contravariant Parameters][1], is open for discussion. If you do not > recognize those terms then hopefully the introduction coupled with the > [examples][2] will help. Here is one snippet that demonstrates > covariant return types: > > interface Repository { > function fetch(int $id): ?Entity; > } > > class UserFactory implements Repository { > function fetch(int $id): ?UserEntity { > /* Since UserEntity is an Entity, this is now allowed */ > /* ... implementation ... */ > } > } > ?> > > Covariant return types and contravariant parameter types are highly > requested features; here are a few of the bug reports: > > * https://bugs.php.net/bug.php?id=71825 > * https://bugs.php.net/bug.php?id=72442 > * https://bugs.php.net/bug.php?id=75385 > * https://bugs.php.net/bug.php?id=75823 > > There is a [preliminary implementation][3] that is available. It will > not be rebased during discussion to allow people to check out the code > and get updates without worrying about it breaking. The code quality > can definitely be improved, and there are still a few todo comments in > the code. > > Please do not discuss the items found in [Future Scope][4] as part of > this thread, which includes discussing types such as `mixed`, > `scalar`, `numeric`, etc. > > I look forward to your feedback, and especially with your > experimentation with the implementation. > > Levi Morrison > > [1]: https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters > [2]: https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters#examples > [3]: https://github.com/php/php-src/compare/master...morrisonlevi:variance2 > [4]: https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters#future_scope It has been two weeks now. If you want to provide any feedback, or follow-up on anything from the discussion, please do so soon. I hope to put this to vote before the end of the year.