Future of memory management in D

Steven Schveighoffer schveiguy at gmail.com
Thu Nov 18 13:05:02 UTC 2021


On 11/17/21 11:24 PM, rumbu wrote:
> Finally, I found [something](https://digitalmars.com/d/1.0/builtin.html) 
> from the old D1 page:
> 
>> Complex Numbers
>> A detailed comparison with C++'s std::complex.
>>
>> The most compelling reason is compatibility with C's imaginary and 
>> complex floating point >types. Next, is the ability to have imaginary 
>> floating point literals. Isn't:
>>
>> c = (6 + 2i - 1 + 3i) / 3i;
>> far preferable than writing:
>>
>> c = (complex!(double)(6,2) + complex!(double)(-1,3)) / 
>> complex!(double)(0,3);
>> ? It's no contest.
> 
> 15 years ago. I will reply  with this quote to everyone who has "another 
> library solution".

Let's adjust the straw in that man:

```d
import std.complex;

auto i(double v)
{
     return complex(0, v);
}

void main()
{
     auto c = (6 + 2.i - 1 + 3.i) / 3.i;
}
```

-Steve



More information about the Digitalmars-d mailing list