On Thu, Jun 27, 2024 at 2:35 PM Rob Landers <rob@bottled.codes> wrote:

>
>
> On Thu, Jun 27, 2024, at 06:07, Saki Takamachi wrote:
>
>
> I agree with Gina. Being able to change the class of a computed result of
> an inherited child class causes several problems.
>
> The points raised in the `BCMath\Number` discussion can be summarized as
> follows.
>
> - If it is possible to perform calculations on parent Class and child
> Class, what should the resulting class be?
>
>
> Ask the class what it wants to be?
>
> - Multiplying the distance class and the speed class should give you the
> time class.
>
>
> That would depend on the library’s implementation.
>
> - Similarly, multiplying two distance classes together should yield an
> area class.
>
>
> See above.
>
> - If only child classes have a property that should be specified in the
> constructor, how do you determine the value of this property in the result
> class? Perhaps it is possible to determine the value of the property, but
> in that case the commutativity of the computation should be lost.
>
>
> This can be handled via the child class in static methods, per the library
> specifications.
>

How is the library supposed to do that in the absence of operator handler
functions that can be overridden, or at least called when an operator is
encountered?

Jordan

Reply via email to