Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120682 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77184 invoked from network); 26 Jun 2023 15:44:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Jun 2023 15:44:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2EA181804D4 for ; Mon, 26 Jun 2023 08:44:00 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 26 Jun 2023 08:43:59 -0700 (PDT) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-3f9bdb01ec0so42462525e9.2 for ; Mon, 26 Jun 2023 08:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1687794238; x=1690386238; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zY9IMTFJuTV6hqB2aQ5W3YDmVRYyLACtP9L5Iw7+w3I=; b=GMh5Pvq9NUC8u1axk6yZiOZayzaDIlCrtk+FPQYohaeYfb6v9zFPsVwvWuGi1pHV+E W/K9H9ehSSuNB4uh1SNS+Uw3p8Xws+aBuFqOzw+Mc+L4JiI3V0CcL4Cw8pTPwRaxEkvT rXp5bcZlIkLvEtDoH697t3aZLKgLhdMHM472g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687794238; x=1690386238; h=content-transfer-encoding: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=zY9IMTFJuTV6hqB2aQ5W3YDmVRYyLACtP9L5Iw7+w3I=; b=jnS4Z6wV1DEycfMCB4wOuxsWqCwBe8lOQXYsh0RtmW/plCMcM0XWTYrNIpL2gF+57d e2mIMKa9ZaAehIjqhjmPn9dpzZe8iZx7f1mugueaIlrSchsJWoFgyRo53gmSmtCnLoB/ /pEC/xcFVAVQl8yMlEV+iw59TdahnUb6yv7WGOpfq64GYl9fzL0PCTy5hi3Zsag/hnSJ 3rUNA8VdrXa7RINfUDBZJv/56uVgEunBzt3oLJ9hpJbwdgdEkgjnB16SN1eMUVyod8Nw nQvLdSwE7T9pVYzJ8zhs3E1xEfmtLiH0hXoQM9gfalBBDenrWUTo3rvhf7sNMy+J0LA0 cBhw== X-Gm-Message-State: AC+VfDwkgWkVa02BYTroEVitGsx5WHe4e6t6ZD4buJXDz/IBKABHkGIB GXL8cCxMA6GN5z/1Poz6vTxC8Hf5kY9Ym1veZU6L+g== X-Google-Smtp-Source: ACHHUZ7qAYeafSE29hi4ahWAz+jzIqr3z44IdFUcszDLm+AiEBJMrP6HpMIjCEmfDLJUBwbUbDyCz9DI7a3WR58Tlz0= X-Received: by 2002:adf:ed09:0:b0:313:e526:f6dc with SMTP id a9-20020adfed09000000b00313e526f6dcmr5680732wro.48.1687794238066; Mon, 26 Jun 2023 08:43:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Mon, 26 Jun 2023 09:43:46 -0600 Message-ID: To: Levi Morrison Cc: David Gebler , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Interface Default Methods From: internals@lists.php.net ("Levi Morrison via internals") On Tue, Jun 20, 2023 at 9:46=E2=80=AFPM Levi Morrison wrote= : > > On Tue, Jun 20, 2023 at 6:29=E2=80=AFAM David Gebler wrote: > > > > On Tue, 20 Jun 2023, 04:10 Levi Morrison, wrote: > > > > > > I like the idea of this RFC - in fact it's one which has been near = top of > > > > my wishlist for PHP language features for a long time - but I think= this > > > is > > > > an issue with the proposed implementation which at the very least > > > warrants > > > > highlighting and discussion. > > > > > > I understand your concern but personally believe it's overblown. This > > > problem already exists with abstract classes, but doesn't seem to be > > > that much of an issue in practice. I hope static analysis can fill th= e > > > gap here, but don't think these checks are necessary to ship this > > > feature. > > > > > > > > > Yeah I suppose I'm just saying "Interface default methods" can be > > interpreted a few different ways and there's key differences between > > Java-style, versus syntax sugar for mixing an interface and a trait in = to > > one unit, versus a user can effectively extend multiple abstract classe= s > > but with interface keyword. > > I will update the RFC soon. In my head it was so obvious that it would > be similar to regular inheritance and less like traits, to the extent > I didn't even realize I'd need to specify it. This is why discussion > periods can be valuable; the RFC doesn't always say what's in the RFC > author's head :) I have significantly updated the RFC. There's one more topic that needs to go in there, tentatively called 'default cancelling': ```php interface Interface1 { function m1() { /* ... */ } } interface Interface2 extends Interface1 { function m1(); // may or may not change signature } ``` For various reasons which I'll put in the RFC, this will "cancel" the default, meaning any class which implements Interface2 instead of Interface1 will not receive that default.