Re: [RFC] [Discussion] Support object type in BCMath
| From: | Barney Laurance | Date: | Wed, 03 Apr 2024 19:19:44 +0000 |
| Subject: | Re: [RFC] [Discussion] Support object type in BCMath | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122915@lists.php.net to get a copy of this message | ||
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)