Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116834 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91703 invoked from network); 6 Jan 2022 16:29:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jan 2022 16:29:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 024DC1804C4 for ; Thu, 6 Jan 2022 09:37:03 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,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-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.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 ; Thu, 6 Jan 2022 09:36:59 -0800 (PST) Received: by mail-ed1-f51.google.com with SMTP id a18so11234041edj.7 for ; Thu, 06 Jan 2022 09:36:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1aX/D+SrLVtY0BGaofoLh+D8SMKqU2uTVs1UtCUFv60=; b=KI6yXuvCCwmwuFMTrsO6YQhPmKRetJFbLTDi1Vz+OmEwVu/1GgEfIQ7Nf4mTWsbILP +O8bv1/wG78cnDDrkGHVwl6hCdpC/5HXjYmyUOAKIRveB3PtJwYBTpLUlE5Y3BjzkvRM hjJiJ4Sg2Hb1PgIQVpWFclFkJk6MYeQhlt/BLsCS+xGzglTfl+xJXmPU3CarVoA7mX2a ivtvXSqd85r8nzEa3UyyDcDbngpokY/WNneCTLuaDn/YzfBUWHAI7HHlZeh2Tyz2+eYD 7QMdNLQ1PgNQEWv6XzDX7g9s6zF70TpkPWCDpB30ZfG194ELc/s8PZncFtSKKSjHjHry pfXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1aX/D+SrLVtY0BGaofoLh+D8SMKqU2uTVs1UtCUFv60=; b=woSS3XQwHRi35qmRW3lYXiqPLJ3Dyt+9SB103Ngo8rTtTt/YoRf1dX2m6NUAxhIo8/ I26z2lNk72dSEHR19ABzQggy5bE+wxxlauO8nd7GA3zVNc+rXZnuBuCvCCq/xc5CUDqY nlzlcHXjiGkdBoC2JqC9ZW7feT/QKYnQEzHslvgrfia5HfA4GxyhLizo8tiS+YUhRVqV 981asACJEIr5wKr2ZthJ9AyVs0axevViSD1g2upccuvZoNbhZ9006kl+PNzmIa5lVaft i/9VAFy0ZIbY09HBOftRYBKPzFwbXsyl+a3CIXpjx/9LDIxRBU+DHcT/dB8YZ5X8uoNn pR6g== X-Gm-Message-State: AOAM530ydJAMasTuJu64qd8GIuNX16DxKtriC74Im4mENespUDfldpxe kOqKDSHPw5RKZLXfAzcX86PK2xNmj8kyZ+KWvh6r6p4n X-Google-Smtp-Source: ABdhPJxxiGJfZJfLd1kw8HERoeEl4XYFwjAf9kuQ16k65vbk+ildL1gBN+pibnp6rxwl0TDMf8VCzmBUVGclZcUa7Zo= X-Received: by 2002:a05:6402:11c7:: with SMTP id j7mr55712947edw.169.1641490618189; Thu, 06 Jan 2022 09:36:58 -0800 (PST) MIME-Version: 1.0 References: <1641335738.195767637@f174.i.mail.ru> <5a4aebf8-e592-4517-8930-d18b112ef1fd@www.fastmail.com> <5a99809d-afda-546c-5a11-a4f0f821aa37@korulczyk.pl> In-Reply-To: Date: Thu, 6 Jan 2022 19:36:41 +0200 Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000330cbd05d4ed51de" Subject: Re: [PHP-DEV] RFC: Trait expects interface From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000330cbd05d4ed51de Content-Type: text/plain; charset="UTF-8" On Thu, Jan 6, 2022 at 7:12 PM Rowan Tommins wrote: > > But some comments seem to be hinting at some *separate* advantage, to do > with "correct usage" of the trait, which I haven't grasped. It's possible > that the mention of static analysis relates to that in some way, and I'm > just completely missing the point. > Yes, traits are a language construct that has in general more negative implications than positive so it's good to keep an eye on their usage. One of the okish usages is to define some implementation for an interface that classes can use. Limiting that trait to be used only by classes implementing the interface is seen as a restriction placed on the trait that would not allow it to be used in other places when it might have a negative impact. Just as a note, on the composition vs inheritance line, I see traits somewhere in the middle. I'll always prefer to go for full composition, even if that means a bit more boilerplate. The implementation can very well sit in a class and have it as a dependency of the class that needs it. Alex --000000000000330cbd05d4ed51de--