Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126791 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id D294A1ADB97 for ; Sun, 16 Mar 2025 19:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742153316; bh=kdZ9Ha46Yx1YxWNWIOsR2t/gqOY40+xYZK40aXtuplQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LCIdu1nz7KrqJ2zdOgR1tjShD6hA7FMUhj7sAmtvPwZZKD1eNtnF0nU1sQqLmFmO1 vDdYJpz9CmsFTzL/SjFce4mTQPbumY38N7IdeTDTVPt1e3xcBUe5cHVxSR4eoWnw5m /EPfqrlsKCQbiIGaAUB2Vd+HIVOq/yC+QVNYaSUrMeIgAw7eEFrf95b4Q+gCPGiEfa IW9kaMv9bgzhZagQOcSxTBIpBBX5Hg1C9yiWT3IDx4jpmrVXSSIA+fUh4bEcRJ0SiK d2h/HvN41rQigsyjFBCBpWG+TS+DaKeUK1BGsP2l1DDrd3LpiDxFrreWcbehUy545h SRqOTTQ0nOBGw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1C56F180082 for ; Sun, 16 Mar 2025 19:28:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 16 Mar 2025 19:28:29 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2ff187f027fso1953178a91.1 for ; Sun, 16 Mar 2025 12:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742153460; x=1742758260; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kdZ9Ha46Yx1YxWNWIOsR2t/gqOY40+xYZK40aXtuplQ=; b=XVkwXJkf9QS5Tg10UXq9VzGVH3ljhVbNUz0FpzrE8qz0ESTmWaTP0uhbUEXDXw7x2i A6vfI8ECKLzM61ehzks3v3FLZRJpnJHlxUefMv3sxIvhPLJypy0ipNHMucWyqODHkcSw 6hLf6oX/0ALz3GqRLp335eRRmAC/P70JWzttTRxVSEksSI8m8oXFf0LK+ZnTmLP2gDYo nuOvHDtAzJQWktI2JGoEKDMJyWZGOAq5Cv4xBKUYOSDPx2CW/EGsLrm1dZUVvyGbIYVG g/6RTNzNaHPtAH518ByynJ7lekcprNw8KSbm5OdbhIsjGBc1/iwgTVO+Mb0GQ4EK5JRb OlQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742153460; x=1742758260; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kdZ9Ha46Yx1YxWNWIOsR2t/gqOY40+xYZK40aXtuplQ=; b=olFjPwBvzCavklJdlI5gTdtVOiWHxdfydPXESPJN+1OebzPMpkv+Kw8y/ndMlmHxGm 2T0wsjHHQTpCQeE3xUXjChM7LCF+E40XL6TbvEqDqS7QCRYtuYC9Qir3pmzyr1a3Z8E8 57NCj24ixiJl2Xong6kVU4LJdzNR9t8GS8JcQ/uxT+OcWdnwqgumXFMmIe1hT+WfVPLs 4VVbCN/fid/Co2Zcql0aBhZ5+XyCUoYZwmR2iz8NFPV3nDLLEW58GEAemWLy54M3nUwb NSqQN0YB+nVW5bjbhBhv5vJjSbslY3i86pBZH9M0RvVzZxglK1odnvmZjuosXdY3XBdh m7fw== X-Gm-Message-State: AOJu0YxS7YZOyJsR9OfPuv20MsX6G1uDWXKtKZvdCozvxCtJRdrZKMp2 Tg8+EJ+KFAphBQCODE/5yMD7e4vavkPiDagnm8f0X2MHSUexOt326YWHNufiolDTGgm80C0f4zo TIJyJjzgMXUngzIbpfqBxoHda9sEyLQ== X-Gm-Gg: ASbGncugVylOzEjnC1wFESd+FTvRjnHFkeamXLX5IgDT7yGWpisyU2LRneZea2sWnDv XpGuvxGZZy21WVRQo7rIkOOBNO62LicYwCH/ycMwZnRXjLT1me+tH+tqHq4gFVUG1Hb78mb8Y9L ojjP7hgYOWjcaMwh0ux8xsFqvH8Np57W1Hh6DZ1vvMM677nm8V+zhNbskV/fU= X-Google-Smtp-Source: AGHT+IEuGjQ2ZHq13qjQKkWg3q3Fm8vYOhs7f/NWPkPcbbXwpcA3tciW3b4Ga0nDZ17d86h9AbjX8RiE7jMGdARm//o= X-Received: by 2002:a17:90b:53c3:b0:2fc:aaf:74d3 with SMTP id 98e67ed59e1d1-30135e7dd6bmr16870277a91.4.1742153460360; Sun, 16 Mar 2025 12:31:00 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 16 Mar 2025 12:30:34 -0700 X-Gm-Features: AQ5f1Jq6rV1OOkjrcoh7arL-VwQYqHlKL6ya26VG1xynwi-50MuhQZx2cBKR6B4 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Never parameters To: Daniel Scherzer Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000262c5306307ab63f" From: matthewfonda@gmail.com (Matt Fonda) --000000000000262c5306307ab63f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 10, 2025 at 12:07=E2=80=AFPM Daniel Scherzer < daniel.e.scherzer@gmail.com> wrote: > Hi internals, > > I'd like to start discussion on a new RFC about allowing `never` for > parameter types when declaring a method. > > * RFC: https://wiki.php.net/rfc/never-parameters-v2 > * Implementation: https://github.com/php/php-src/pull/18016 > > -Daniel > Hi Daniel, I believe this feature essentially amounts to "add methods which can never be called", which in my mind makes no sense. If a method types against an interface, and that interface uses a method with a never parameter type, then we cannot actually call that method. We'd need to know the specific concrete type, which defeats the purpose of using an interface in the first place. See note from Nikita [1] from previous discussion which expands on this idea more, and shows that generics is really what we need here. [1] https://externals.io/message/115712#115719 Best regards, --Matthew --000000000000262c5306307ab63f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Mar 10, 2025 at 12:07=E2=80=AFPM Daniel Scherze= r <dani= el.e.scherzer@gmail.com> wrote:
Hi internals,

I'd like to start discus= sion on a new RFC about allowing `never` for parameter types when declaring= a method.


-Daniel

Hi Daniel,

I believe t= his feature essentially amounts to "add methods which can never be cal= led", which in my mind makes no sense. If a method types against an in= terface, and that interface uses a method with a never parameter type, then= we cannot actually call that method. We'd need to know the specific co= ncrete type, which defeats the purpose of using an interface in the first p= lace.

See note from Nikita [1] from p= revious discussion which expands on this idea more, and shows that generics= is really what we need here.


Best regards,
--Matthew
--000000000000262c5306307ab63f--