Re: Supporting object types in BCMath
| From: | Saki Takamachi | Date: | Sat, 16 Mar 2024 15:37:55 +0000 |
| Subject: | Re: Supporting object types in BCMath | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122658@lists.php.net to get a copy of this message | ||
Hi Barney,
> I would suggest if you do this only supporting immutable objects, or at least making immutable
> the default, the one with with the simpler name, and reserving the mutable version specifically for
> when people want to use mutability. The strings used with bcmath today are effectively immutable.
>
> It's hard to see why a number should be mutable though. Users of the class can always wrap
> an immutable up it in a mutable object if they want.
>
> If you do have both mutable and immutable it might be worth giving the methods separate names
> to make the distinction clearer - e.g. "add" for mutable, "plus" for immutable,
> and maybe making the add method return void.
Thanks, that's what I was starting to worry about too. It seems like a good idea to support
only immutability, as you say earlier in your proposal.
Regards.
Saki