Fix for incorrect overloaded assignment
Subject: Re: overloading problem
Jarkko Hietaniemi writes:
>
>
> Please proofread for me. Isn't what Chris is trying to do
>
> to get overloading to promote the unblessed scalar $c
> containing '2' to a Math::Complex blessed object?
>
> Please correct me if I am wrong but isn't this impossible?
>
> As there are only three possibilities for binops: normally ordered
> arguments, inverted arguments, modifying binop: the overloading will
> swap the honest Math::Complex $z as the first argument _and_ pass the
> third argument to minus() as undef (perldoc overload) and therefore
>
> a) the value of the result will be $z - $c, not $c - $z
> b) minus() will modify $z, not $c
>
> I may just too sleepy...
Looks like an overeager optimization... Try this:
p5p-msgid:
199704112225.SAA03482@monk.mps.ohio-state.edu