Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120780 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 94557 invoked from network); 11 Jul 2023 17:28:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Jul 2023 17:28:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7F1031804F8 for ; Tue, 11 Jul 2023 10:28:22 -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, 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-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 ; Tue, 11 Jul 2023 10:28:22 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-4fbb281eec6so9361327e87.1 for ; Tue, 11 Jul 2023 10:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689096500; x=1691688500; 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=Y0coF4vQUoKoev3OFAUQj9hKpWMRO7l4Waef6i3QgHA=; b=rubnq8vTtY5j6sHD+/IFcIX3q6I6MxP/lSrq1+X7CvOCUY1i4qNEAYOCXDBy00eIJG YzLNbqPuSMmu9LcEtfjNpRTgKGYLF56sgl/ccwtqT1Q2A/jM7JjhxhvNQsJdqoZi3yM8 d/OQEDNMem4f/JIEgRxlAJPHa+1losFrWMKw9cVuURl5rvzanEgeUzxJccE/TwBXOx58 1UM0WcZRo1ResUcowx78GrK4yzvanOOhFyEU09SMPPZagKHsOdw2BUNxogP8p7P9TiDz C2UZSEf5k3W6Wa2M+K0G92iBTD7176acmZMwUBQV3yByeshJkFb04DAzEUvO9DT93WJX fd1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689096500; x=1691688500; 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=Y0coF4vQUoKoev3OFAUQj9hKpWMRO7l4Waef6i3QgHA=; b=I2wNbckgGb/jN7CRkU55mh8dyP5wurO0in9+DzVJBHlnVOFZSZ5WBeaVQpo3Jck9r0 nWDrL6OE0GtpgJAlJNFqfxmWYSW0SNPNcEiUWhu2VTnwxaQzdKaj4crRvJGTd8i8zmx+ lO0tgrfGp2w5tddLN3YcPjhIvcpeEn2Y8Aa4E/Q+kfqlpPLI9YXDeVGLpwdSAxMi3HD3 DnDaHBtJ5+6cc/w//CoqfM7p211IJptAcbACMcTMzcXloGa5HnGg9WAwC7p3i2nL6uOP rDv1YcTXA4XBIVGxvkReM9XvnCk5vurVGibVZPUXUWYZOpet7CYt1YkdC2TT7tUKP6qJ KpCg== X-Gm-Message-State: ABy/qLZKjRecG1+/62mltPY2qXmBoSFZz05RiiYgPNWmoST52JPTpBc/ qiCjcz7ZdcOvWhtD+NYSei3K55szpjmpuCrSTHomfdD6FCyROw== X-Google-Smtp-Source: APBJJlGEa4F34yNCoKTVtWPg5HCYQQEd9gMKaEA5bb59LQarIcVmlrVSZtO8H59hRUgLc811EsAf4aiM7DaKqNvojfY= X-Received: by 2002:a2e:93d6:0:b0:2b7:1ba1:75ae with SMTP id p22-20020a2e93d6000000b002b71ba175aemr7438544ljh.42.1689096499745; Tue, 11 Jul 2023 10:28:19 -0700 (PDT) MIME-Version: 1.0 References: <3a3e7781-c2b4-2880-8048-d19458ac287d@heigl.org> <308d32d6-c145-4f8c-8779-101a696b60a0@app.fastmail.com> <66e67efa-1f41-4971-b070-7785f99ab286@app.fastmail.com> In-Reply-To: <66e67efa-1f41-4971-b070-7785f99ab286@app.fastmail.com> Date: Tue, 11 Jul 2023 19:28:06 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] Interface Default Methods From: landers.robert@gmail.com (Robert Landers) > Real code I wrote a week ago (specifically, for a series of events in a d= omain model): > > https://gist.github.com/Crell/f5929e2ee44decd4e9353c41874f26c8 > > Two different interfaces, that I want to be able to check against, but th= eir implementations are trivial. One of them is used in 2 classes, the oth= er in 3. A base class simply wouldn't work, both because it's semantically= incorrect (these events are not all "special cases of" some common definit= ion, that's not the data model), and because then I couldn't have the class= that uses only one of them. Traits, for now, are the best solution, and t= his is an approach that gets taken a lot. Ah, I see. I would have simply created an ErrorResponseCarrier class, then had PreRouting and PostRouting extend them and implement whatever other interfaces they needed. IMHO, using a shared base class reflects the inheritance better because they are siblings (at least these appear to be logical siblings out of context, IMHO) and should look like siblings in a class diagram. Their current dis-jointed-ness strikes me as odd and the usage of traits in this way strikes me as an anti-pattern. But I came from a PHP world where traits were nearly forbidden or used very sparingly. > As for it being "back door multi-inheritance", well, Java, Kotlin, and Ru= st all do essentially that now. So we're hardly breaking new ground, desig= n-wise. If anything, it's playing catch up on data modeling capabilities, = an area where PHP is still sadly very much lacking. There's a reason I don't use those languages :p but in all seriousness, I get what you're saying.