Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115728 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 7664 invoked from network); 14 Aug 2021 15:48:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Aug 2021 15:48:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D715D1804DB for ; Sat, 14 Aug 2021 09:19:43 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com [209.85.222.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 14 Aug 2021 09:19:43 -0700 (PDT) Received: by mail-ua1-f48.google.com with SMTP id a4so5723087uae.6 for ; Sat, 14 Aug 2021 09:19:43 -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=vMB0FA0OfSq2xqvtQBF/sECMVzP1amZszblefShX9X0=; b=brQH4jE20FBbIj9CXos7BMiB/PovAi2asemsgYDdRuwXmsTPG50k4UA4XOabwtRZu2 9g77l5SgUexCoAosM1LWcudnlIx7IffwZTruRdYi2P7wIMoJr2rOPEOv1ZzPRG9N3YjM kelELqJD204i8ZQmCC07ii/spVuNn6iHtlFSiyQaHtImoBWkFG4ikW15wxlYi7Rja97J /MTvXHh55rzOi/mtgVlFOxV4tc+gSHQ3t2QhLjidBNXJTlxZnSOIUnP4y1MFJzdy5Hal bLubCC5W4N5EKRWfyImyCecOSrWKPsgwxXtZ1YNua5sPsH/HQYhYlYP1UbPtqKNO5IxZ sHOQ== 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=vMB0FA0OfSq2xqvtQBF/sECMVzP1amZszblefShX9X0=; b=iI2RRIwut/y+PH1hbSlJs5HsZCIAEExQy5a2qOxIQ/gs38udDLKDt/wqf5YsD+PxoU Ko+PdwMBziYfPnWz7WsZKI8xWmI13KyLqpv7Tk9gLlrf6vm5hrh3J1zizGBJLqk9x+PH idllmZJFB2KjJ16MZR5Xs820G0XcTw/KOhWgTEqmUQXoqvlahBMZ78C9hC1+a+MyoBaA wiNA8dhDZALcSX3XuQPcekTh6YYH03yoMhi9UFhKRIRQ0eKrs5DZB4qr0cUtey3FWk05 tPJDcdNGBOSmvG0RApueUr9iAHbGsolRzn7B94EggUbME7NgTxpsicmxtFHpw6odk1v9 tb3Q== X-Gm-Message-State: AOAM530YVm9EDRcNUl8hlDPLEj7msfyOVD6KN4u+lopRHQ4GAEWHUosN Hf3CLhIW9e7TWIth+D6tNa4dSG2KwrSPnyGVlmo= X-Google-Smtp-Source: ABdhPJzrEkYMzeEEVURhX9P53uWX3Fb2AU/6C2cccBSaMJAHYysttLfPtzjmmKmyiJgWCNW3IdNu8c52OMGK075mWo4= X-Received: by 2002:a9f:364f:: with SMTP id s15mr5574525uad.68.1628957982109; Sat, 14 Aug 2021 09:19:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 14 Aug 2021 12:19:30 -0400 Message-ID: To: Jordan LeDoux Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000e0b31805c987554c" Subject: Re: [PHP-DEV] [RFC] Never For Argument Types From: matthewmatthew@gmail.com (Matthew Brown) --000000000000e0b31805c987554c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey! Using the "never" type to require that downstream libs specify a type does not make intuitive sense to me, because the same is not true the other way (covariantly) for return types. The existence of a "never" type on an overriding method does not require that upstream libs specify a return type =E2=80=94 this is perfectly valid: class A { public function foo() {} } class AChild extends A { public function foo():never { exit; } } Best wishes, Matt On Fri, 13 Aug 2021 at 19:27, Jordan LeDoux wrote= : > Hey internals, > > I've been working on the draft for my operator overloading RFC, and in > doing so I encountered a separate change that I would like to see. > > That is, the use of `never` as an argument type for interfaces. Since > arguments in PHP are contravariant to preserve Liskov substitution, `neve= r` > as the bottom type should indicate that implementing classes can require > any type combination they want. This is in fact consistent with type theo= ry > and set theory, and is how the bottom type is treated in several other > languages. > > In this case, the bottom type would be used to indicate covariant paramet= er > polymorphism while not conflicting with LSP. > > This would provide a sort of minimal form of generics to PHP without the > issues that actual generics present from an implementation perspective. I= t > would not, however, restrict or hinder any future RFC for generics. > > This is at the first draft stage, and I currently have the RFC on a githu= b > repo to allow for easy contribution and collaboration. > > Any feedback is greatly appreciated. > > https://github.com/JordanRL/never-argument-type > > Jordan > --000000000000e0b31805c987554c--