Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110576 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90887 invoked from network); 16 Jun 2020 11:35:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Jun 2020 11:35:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B44031804FD for ; Tue, 16 Jun 2020 03:20:43 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS20857 136.144.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from outbound5.mail.transip.nl (outbound5.mail.transip.nl [136.144.136.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 16 Jun 2020 03:20:42 -0700 (PDT) Received: from submission11.mail.transip.nl (unknown [10.103.8.162]) by outbound5.mail.transip.nl (Postfix) with ESMTP id 49mPNT0YYBzGntC for ; Tue, 16 Jun 2020 12:20:41 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by submission11.mail.transip.nl (Postfix) with ESMTPA id 49mPNQ1KcDz2Bd7l for ; Tue, 16 Jun 2020 12:20:38 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id l17so2336604wmj.0 for ; Tue, 16 Jun 2020 03:20:38 -0700 (PDT) X-Gm-Message-State: AOAM533rnFevB/04VMCwAqfqJLG7UwViwoOHku7eVOAMMlmBsWp7Z0bS 0ujFy1vh4szO1NZEZV7B7khIOU64eP+C3O9prV4= X-Google-Smtp-Source: ABdhPJzzv9gKR05owmnNTcEzgpI7bPRcvXHZD/+bKGspUVyoAG4GQqn295cErrIUbjaZT9XOQGhzpYVLY6Czf41UQx4= X-Received: by 2002:a05:600c:22c1:: with SMTP id 1mr2614543wmg.50.1592302837248; Tue, 16 Jun 2020 03:20:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 16 Jun 2020 11:20:25 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Marco Pivetta Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="000000000000fd389e05a830e41f" X-Scanned-By: ClueGetter at submission11.mail.transip.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=transip-a; d=pmmaga.net; t=1592302840; h=from:subject:to:cc: references:in-reply-to:date:mime-version:content-type; bh=pBDnUYH7YNV9pPPabM0ygPyhVU1q5kEaQCazeykP0+I=; b=ct8FlSqWOOXyyTGIJxULWpFdmGKgVN9/V7zJzsEuFlN2rIL0b4IUjLZacVJZrGyJG+fVjJ bKk5/cEjrISH84bJHg6K1uSxwS7hRqthHrwP2WBjPmd+w650AUROe1RTCqIehUoOAA1rmf ATxRBAp5RXE8TY2YlUrdTsStBtKYmTYCPeV7PvgAEV+Qz8IyUpN1jN3vMO6lyMkEqq0Lzm TnOYTdjhjAzvr4VUGB5goKy3xceIUHVpbfdnOI97nPVVaQBzkz5pnMahugzxVlypMS1RZ7 UoErNYB2YwxTclFKcUIuaaJWBNfs5Mkz9Nrst1oWs4uC6ARjm3RBlNDysro8UA== X-Report-Abuse-To: abuse@transip.nl Subject: Re: [PHP-DEV] [VOTE] Remove inappropriate inheritance signature checks on private methods From: mail@pmmaga.net (=?UTF-8?Q?Pedro_Magalh=C3=A3es?=) --000000000000fd389e05a830e41f Content-Type: text/plain; charset="UTF-8" On Tue, Jun 16, 2020 at 10:19 AM Marco Pivetta wrote: > On Tue, Jun 16, 2020 at 11:05 AM Nikita Popov > wrote: > >> The original RFC could at least >> make a consistency argument, but the final form, which converts an >> existing >> special case into an even more convoluted special case, can not. Why is >> __construct() exempted, but __clone() for example isn't, even though >> similar considerations apply to it? >> > > While `private final function __construct()` prevents child classes from > making the constructor open, or accessing it (important for abstract > types), `protected final function __clone()` achieves the same without > having to rely on the `private` visibility modifier ( > https://3v4l.org/psR5F, for example). > In my opinion, the example given by Marco on the discussion thread about sealed types is a good argument on why __construct should keep the behavior (https://externals.io/message/110251#110255). You would need to write a lot of convoluted code to achieve the same behavior as you currently can. It is true that cloning is then possible from within a subtype, which is > indeed a bit of a problem: https://3v4l.org/qupHR > I don't find that problematic. If ultimately your goal is to disallow cloning, doing it by visibility constraints is cheaper and covers 99% of the cases but it's still possible to enforce it even for the child class by throwing: https://3v4l.org/U1LMQ Regards, Pedro --000000000000fd389e05a830e41f--