Why is complex being deprecated again?

Lars T. Kyllingstad public at kyllingen.net
Sun Apr 15 14:09:12 PDT 2012


On 15/04/12 14:29, Stewart Gordon wrote:
> On 15/04/2012 04:10, Mehrdad wrote:
>> Why is complex being phased out?
>> What happened to all this? http://dlang.org/cppcomplex.html
>
> There was a brief discussion about it back in 2008
>
> http://www.digitalmars.com/d/archives/digitalmars/D/Replacing_built-in_complex_What_s_this_about_81214.html
>
>
> My impression was that the plan is to deprecate it once the stuff in
> std.complex is complete. std.complex has clearly grown since that
> discussion, but it still needs a pure imaginary type (and I don't know
> what else at the moment).

I absolutely do not think it does.  There is nothing you can do with a 
pure imaginary type that you cannot do with a complex type. 
Furthermore, the imaginary numbers have the unfortunate property of not 
being closed under multiplication and division, which is troublesome for 
generic code:

   ireal x;
   x *= x; // boom

It seems nobody noticed, but I did in fact rewrite all of std.complex 
two years ago (almost to the day) in preparation for the deprecation of 
the built-in types.  If there is anything missing from the module, I 
will be happy to add it.

-Lars


More information about the Digitalmars-d mailing list