Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122915 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id AEE761A009C for ; Wed, 3 Apr 2024 19:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712172017; bh=URddptdndWe+1kLS9STDvatcHPz2FD8XRNzZvPMwEQc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=m1IGDH2LGFq1Ey70zOqNlUsYyh3iPXjex1N7wVqfA69BZKvbJTPybkRzcYvPck41E FUPOrnKLN9y54R4IPytoUQcsbTTghbIOw6w5afZWHjqUonOPlBYZzx4AM52VNvcEb0 pHABif9AsJe1mTP02bf2VeDqRb6Q8gKaOA3sEB+K2RC68LDyu7UODgFeTn4+vKlH6t sSqEFGOQ1qi5YshNvlWd2t+/wTqN7PeUZkHrkliTiK6BILfFfN9c0svdStpNVrGRUn x4wjryMp5DFdHOPxwdHyAqO8mlw7uWtd5HAm+RcKA4r1s8ylyPT51ySWi94cBrKi/7 5+T8fTrEcOPVQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1FA2818097D for ; Wed, 3 Apr 2024 19:20:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_50,DMARC_MISSING, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from gliadin.co.uk (gliadin.co.uk [80.82.115.221]) by php-smtp4.php.net (Postfix) with ESMTP for ; Wed, 3 Apr 2024 19:20:15 +0000 (UTC) Received: from [192.168.0.17] (hari-18-b2-v4wan-169870-cust740.vm1.cable.virginm.net [92.239.242.229]) by gliadin.co.uk (Postfix) with ESMTPSA id 881FDFA2957 for ; Wed, 3 Apr 2024 22:19:45 +0300 (MSK) Content-Type: multipart/alternative; boundary="------------0eSujwPUgpQSEZG6s6fwNp3Q" Message-ID: <594919c9-de36-4136-ad3e-27a75b0467b8@redmagic.org.uk> Date: Wed, 3 Apr 2024 20:19:44 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath To: internals@lists.php.net References: <4F094EDA-5058-407D-AF39-06FD934FDE1F@sakiot.com> <68CF373E-6ABF-4471-8992-813B4BA1B508@sakiot.com> <904197f4-afb5-401e-9e17-7a655c5449d0@alec.pl> <655FEA80-9AB4-4AAD-A310-70ED968C97A2@sakiot.com> <8FB87901-02D7-4934-9119-55B21CEDDA9D@sakiot.com> Content-Language: en-US In-Reply-To: <8FB87901-02D7-4934-9119-55B21CEDDA9D@sakiot.com> From: barney@redmagic.org.uk (Barney Laurance) This is a multi-part message in MIME format. --------------0eSujwPUgpQSEZG6s6fwNp3Q Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 03/04/2024 01:42, Saki Takamachi wrote: > If make a class final, users will not be able to add arbitrary methods, so I think making each method final. Right, if a class is not final but has only final methods (including constructor) and no protected properties then it allows people to extend it but not break any encapsulation or (I think) impose any more BC requirements on the maintainer (unless we care about conflicting with method names of child classes when updating). It lets people just do something a bit like adding 'extension methods' in C#. I like it. People could write e.g. `$bcChildNumber->isPrime()` instead of `BcNumberUtils::isPrime($bcNumber)` --------------0eSujwPUgpQSEZG6s6fwNp3Q Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 03/04/2024 01:42, Saki Takamachi wrote:
If make a class final, users will not be able to add arbitrary methods, so I think making each method final.


Right, if a class is not final but has only final methods (including constructor) and no protected properties then it allows people to extend it but not break any encapsulation or (I think) impose any more BC requirements on the maintainer (unless we care about conflicting with method names of child classes when updating). It lets people just do something a bit like adding 'extension methods' in C#. I like it. People could write e.g. `$bcChildNumber->isPrime()` instead of `BcNumberUtils::isPrime($bcNumber)`

--------------0eSujwPUgpQSEZG6s6fwNp3Q--