On 16/04/2012 07:06, Lars T. Kyllingstad wrote:
<snip>
For any standard type (built-in or library) to be useful, it has to actually be
used for
something.
You mean someone has to use it in order to prove that it's usable and therefore useful?
Well, if a feature isn't usable, it's probably due to something wrong with its design.
And in many cases it's a reason to rethink the design, rather than throw the feature out
of the window.
And in all my years of using D, I have never seen a *single* real-world use of
the pure imaginary types.
How many of those years you spent "using" D did you spend looking at other people's
real-world applications written in it?
Of these, how many have a focus on number crunching?
And of these, how many use complex numbers?
It's bound to be a rarely used feature. But "nobody's using it" is a prime example of a
self-fulfilling prophecy if it leads to the feature's removal.
Do you feel the SETI Institute should have given up years ago?
The reason the imaginaries are so seldomly used is precisely because there are
so few
things you can do with them. Basically, if you do anything beyond addition and
subtraction, and multiplication with a real number, you are back in the complex
plane. And
if those operations are all you need, the real line is just as good as the
imaginary line,
and you might as well fake it with a real floating-point type.
This doesn't cover the case of multiplying a complex number by an imaginary number. In
the absence of imaginary types, one would have to use complex(-z.im * k, z.re * k), just
because z * complex(0, k) isn't guaranteed to produce the correct result. Seems a bit
silly. Or have you another suggestion for dealing with this?
<snip>
It is true that the real line can be extended with elements called plus and
minus infinity
(affinely extended real line, see
https://en.wikipedia.org/wiki/Extended_real_number), and
the IEEE floats can be said to approximate this system, but this does not
generalise
directly to complex numbers. The extended complex plane (see
https://en.wikipedia.org/wiki/Riemann_sphere) only has one "infinity".
<snip>
But the Riemann sphere is only one of the various possible extended complex planes. You
could just as well use the polar circle of infinities, the cartesian square of infinities,
or the real projective plane model (by which -∞ = ∞, but ∞i, ∞(2+i), etc. are distinct).
Stewart.