Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115713 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69512 invoked from network); 14 Aug 2021 08:23:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Aug 2021 08:23:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 552E0180212 for ; Sat, 14 Aug 2021 01:55:04 -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-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (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 01:55:03 -0700 (PDT) Received: by mail-io1-f51.google.com with SMTP id e186so16374053iof.12 for ; Sat, 14 Aug 2021 01:55:03 -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=iLJYY7/RXBcePNx38XZUFBBxILidpltA9AHLByCLNwE=; b=KMlvad0dicJJZIPET3DUKtjFf0smxzRq8GdPk/GXqPW5upXv7nVaSwuzNfgsdFoXCU 89/CzrTvB3T5g7n+vizDD768WOFytfaU2lxXQxehkF9873IBhTsBT0dJLdvkdCbS1vGu Bodetbg7I0ZTQIVTY2ToGMDoJKUJHGbjfX9LqXutyhRloVdeambt54yTmbYTV8/y1Y2z b78ObNekxCTCIJE8h0Ak/foN4CRpPrr0uF+lYvrOJuElIXSGWL8VCbR9pDBEicllvaBo VaQFTHN7HoqQU/jPaze2GSnjNu+NN1CfEEJGF6vQgmYXAv2Jby8XIqaxLZji9K6COW3q fdAQ== 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=iLJYY7/RXBcePNx38XZUFBBxILidpltA9AHLByCLNwE=; b=EMMl4E1KUmIbf0l2VCG6gGY7w5t50m70aIgkg4aG19Eo2eSpwLt2hqYjOXR8XOmW11 zyL6rR9gvDg/H3+zVjNCm5nmu/zT/7m8PM18RfPon/AnDrST3oKY0QpbjsH9Le60B5lt iFmvbuM6CYZmGEJtEUptuuASEGsEgUshdTKOmStODNHk/rVWoZIEj8m0Mwa6fTWIZ3WE h1LWiLOl7Q/wRIO3C+7n5CxfiPC5jQYppL6h7wOKhvQFBtHSv3LEFgWoNEjUApcDJMeg TKPTqIFFclptEt1SkuERGFISg9kG9LEB9gpugstl4CvDizsTfPBg26RAPUEg+m5aTnFd XTdg== X-Gm-Message-State: AOAM5304VL2riAxggsR8mGCgvL9ytux9ljrpcFVp250YZLSbuohbFNJO wtbl07dckGsSjkZSlqQQevEzMYbVC1cjMXzw110= X-Google-Smtp-Source: ABdhPJzqg1Qxllsl9Sm3W1u8VGQcm8L1zAJRMciRR8chruqZYoNGpKMtgaEM20LNdofv/lEmVfuVZhdfdHkIBX0ZqvI= X-Received: by 2002:a5d:9906:: with SMTP id x6mr5064529iol.23.1628931300228; Sat, 14 Aug 2021 01:55:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 14 Aug 2021 10:39:17 +0200 Message-ID: To: Jordan LeDoux Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000083828c05c9811fce" Subject: Re: [PHP-DEV] [RFC] Never For Argument Types From: deleugyn@gmail.com (Deleu) --00000000000083828c05c9811fce Content-Type: text/plain; charset="UTF-8" Hi Jordan, Does it make sense to explain in the RFC the difference between never and mixed in this context? The RFC vaguely mentions that never can never be used directly, but if it's limited to abstract class and interfaces, isn't that already impossible to use directly? Or does it mean that the type would "be allowed" on any function, but because of its intrinsic behavior it would always fail if used in non-abstract methods? Another clarification I'd be interested is about dropping the type declaration entirely (e.g. https://3v4l.org/a4bfs), because of covariance (or contravariance, I never know), sub classes can completely drop type declaration entirely. Will never not allow this? Why? Why not? If it does allow this, does it really differ from not having any type declaration on the abstract function? My knowledge in this area is practically null so if I'm asking stupid questions that are easily explained by some blog post I'd he happy to read it. On Sat, Aug 14, 2021, 01: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, `never` > as the bottom type should indicate that implementing classes can require > any type combination they want. This is in fact consistent with type theory > 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 parameter > 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. It > 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 github > repo to allow for easy contribution and collaboration. > > Any feedback is greatly appreciated. > > https://github.com/JordanRL/never-argument-type > > Jordan > --00000000000083828c05c9811fce--