Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120774 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76428 invoked from network); 11 Jul 2023 14:02:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Jul 2023 14:02:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 89CEB18050B for ; Tue, 11 Jul 2023 07:02:50 -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_H3,RCVD_IN_MSPIKE_WL,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-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 07:02:49 -0700 (PDT) Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-6b8ca9bf9beso667182a34.0 for ; Tue, 11 Jul 2023 07:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689084169; x=1691676169; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0wZwkIXIVhm7jRJOEzCfkIpXTnPe84N+25wudw6Go2M=; b=Y4jVwSkiOCsnfix4MpJsY228n3C2bOOBDTuON/KHIdh+EFg+sTvhVmqOysIT1g3dYi hCAiyGmCgXhIiCiKvbU7irHXvW2XUFwDS3k07w+bh12kF2RgO/sQ0xYwg3QBKgaBaLBl KMmcl5OruB5SKhZ6pUq5FJFbOVaGyO4WflUgw30h/ru4Vxs14esQcebTTBnT2xoqZ0SL KgNt0bol+CijyfY3M1hNhoe9JWLB4ZUlgf8WsY5kIZQsMP0r/p30ZLnwj5tQPg+mkhzm zYs4lZ/+ToZtPKZiUEgYOhxmJoIeUUAq492ySKedTKjKlZ9RJyuoijdRgqKwQuzznn7w aEFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689084169; x=1691676169; 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=0wZwkIXIVhm7jRJOEzCfkIpXTnPe84N+25wudw6Go2M=; b=BcDxYq3DDlbmZNiUb1XJXz2pSRhNqvEBkY1XGeQMjSaYbTly9u5edNO9dRTxDzTGz3 uxTAhgw7gma/uHW3msQb4di1b5q1rzIlaoZBGPtqQUXQNqRa1eEZ7qzDv4t0TXm2dmOt CtipY3omoQwRaAmlq6BZZDgGFDwBPSXDn1ENWyJTg6oVPsG7jpIoDeFt81Wd58VgRJk3 KCaQMf8lU5stH38liI7cHcgaaKBK9BGjFa1Bq2OqsXnZzvUemEXD0KDzlItu/HBgejFo owSuP+zykvJAeCRE18FfKPzJbwwcffyoFkQYbLMXfH5aQLKKRis2JsB/zZYS6p6cbvRO zSpA== X-Gm-Message-State: ABy/qLaPoYpYUlWVOMr6DVy/fSUyn9cL+MllKXh0Lcgi1LCHrqJD7HWn ZRfYklu/k1uXSD+R9+i9h1/ZPwiHgET6GqhWbAY= X-Google-Smtp-Source: APBJJlF54C0JVNgPccgyrCojcMoXEjyQXEDXifSTuBaoj29bNDPMMf3YiihKBhG/jNf24Nk2h+N4+toPCG4jgTCACyM= X-Received: by 2002:a05:6358:9faf:b0:134:c37f:4b5b with SMTP id fy47-20020a0563589faf00b00134c37f4b5bmr5651263rwb.1.1689084168869; Tue, 11 Jul 2023 07:02:48 -0700 (PDT) MIME-Version: 1.0 References: <3a3e7781-c2b4-2880-8048-d19458ac287d@heigl.org> In-Reply-To: Date: Tue, 11 Jul 2023 11:02:12 -0300 Message-ID: To: =?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?= Cc: Robert Landers , Andreas Heigl , internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000e19a3a0600368dda" Subject: Re: [PHP-DEV] [VOTE] Interface Default Methods From: deleugyn@gmail.com (Deleu) --000000000000e19a3a0600368dda Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 11, 2023 at 10:54=E2=80=AFAM Micha=C5=82 Marcin Brzuchalski < michal.brzuchalski@gmail.com> wrote: > Hi Robert, > > wt., 11 lip 2023 o 14:54 Robert Landers > napisa=C5=82(a): > >> ... >> Abstract classes solve this problem perfectly. It's part of the type >> system, it's type-hintable, it's mockable, and it's pretty easy to see >> what inherits it as people who inherit it already know what the base >> behavior was when they wrote the code. >> > > Not exactly, How you wanna solve by abstract class two interfaces > which can be implemented using let's say two traits - let's say > > interface Foo { > public function foo(): string; > } > trait HasFoo { > public function foo(): string { return 'foo'; } > } > interface Bar { > public function bar(): bool; > } > traitHasBar { > public function bar(): bool { return true; } > } > > Now I can need to implement Foo or Bar separately or together. > Using abstract class that would require 3 abstract classes: Foo, Bar, and > FooWithBar. > With this RFC that would require just two interfaces with default methods= . > > Now you can easily see how bad this goes if you wanna add 3rd interface. > > Cheers, > Micha=C5=82 Marcin Brzuchalski > > I second this. Imagine a class extends LogAwareAbstractClass. It makes no sense to the type system and it makes it impossible to extend something that actually is part of the domain definition. Interface Default Implementation is an elegant solution that doesn't change the state of PHP while still making things easier and convenient to manage. --=20 Marco Deleu --000000000000e19a3a0600368dda--