digitalmars.D - When will the complex types be dumped?
- Lars T. Kyllingstad (8/8) Dec 07 2009 The decision to dump the built-in complex and imaginary types in favour
- KennyTM~ (3/11) Dec 07 2009 All opBinary-s (opAdd, etc.) aren't implemented now, so e.g. z+w won't
- Ali Cehreli (5/17) Dec 07 2009 An introductory article on Digital Mars explains the rationale behind th...
- Andrei Alexandrescu (6/14) Dec 07 2009 I don't know.
- Lars T. Kyllingstad (15/33) Dec 08 2009 The big difference is in assignments:
The decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2? 2. In that case, when will it happen? 3. Are there any reasons why I shouldn't replace cxxx with Complex!xxx in my code right away? -Lars
Dec 07 2009
On Dec 7, 09 22:40, Lars T. Kyllingstad wrote:The decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2? 2. In that case, when will it happen? 3. Are there any reasons why I shouldn't replace cxxx with Complex!xxx in my code right away?All opBinary-s (opAdd, etc.) aren't implemented now, so e.g. z+w won't compile for Complex!T.-Lars
Dec 07 2009
Lars T. Kyllingstad Wrote:The decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2? 2. In that case, when will it happen? 3. Are there any reasons why I shouldn't replace cxxx with Complex!xxx in my code right away? -LarsAn introductory article on Digital Mars explains the rationale behind the complex types and quotes W. Kahan: "The language of pairs is incorrect for Complex Arithmetic; it needs the Imaginary type." http://www.digitalmars.com/d/2.0/cppcomplex.html The library types can and do work as well, probably because "Appendix G of the C99 standard has recommendations for dealing with this problem." Ali
Dec 07 2009
Lars T. Kyllingstad wrote:The decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2?Far as I know, yes.2. In that case, when will it happen?I don't know.3. Are there any reasons why I shouldn't replace cxxx with Complex!xxx in my code right away?I think we'll have to provide aliases for the existing complex types, so your code should continue functioning after the change. Andrei
Dec 07 2009
Andrei Alexandrescu wrote:Lars T. Kyllingstad wrote:The big difference is in assignments: real a, b; creal x = a + b*1.0i; auto y = Complex!real(a, b); // Also, this doesn't work with current complex types, because // creal.re and creal.im aren't lvalues: Complex!real z; z.re = a; z.im = b; But it's not a problem, really. Since Complex!T is binary compatible with the current complex types I can just insert a few casts here and there. I just wanted to make sure I wouldn't have to go back to creal & co later. -LarsThe decision to dump the built-in complex and imaginary types in favour of std.complex.Complex was made a long time ago, but nothing has happened yet. So I have a few questions: 1. Is this still planned for D2?Far as I know, yes.2. In that case, when will it happen?I don't know.3. Are there any reasons why I shouldn't replace cxxx with Complex!xxx in my code right away?I think we'll have to provide aliases for the existing complex types, so your code should continue functioning after the change.
Dec 08 2009