I'm looking at Smalltalk for some control systems work, for which Complex is essential (plus plenty of other stuff). I just sent in arcSin etc for Complex, which is probably uncontroversial. What I plan to do next, though, is probably easy to get wrong. For my use, anyway, Float needs to work nicely with Complex, and in particular lots of functions that return FloatingPointException and such at the moment should return Complex.
The obvious example is "-1 sqrt", which I plan to have return "1 i", but most of the mathematical functions will change. I propose only to touch the cases that currently return errors.
Is there any obvious reason not to do this? I assume that programs aren't being written to rely on the error returns, for example. regards ws
On 9/30/05, Martin Snelgrove snelgar@dissonance.com wrote:
The obvious example is "-1 sqrt", which I plan to have return "1 i",
It would be possible to make this kind of a change with fairly little breakage by using an exception to determine whether the caller wants complex arithmetic, although this may not be efficient enough for your needs.
--Tom Phoenix
squeak-dev@lists.squeakfoundation.org