Slides from my ACCU Silicon Valley talk

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Wed Dec 15 06:34:47 PST 2010


On Wed, 15 Dec 2010 15:20:01 +0100, Don wrote:

> Alex_Dovhal wrote:
>> "Don" <nospam at nospam.com> wrote:
>>> Agreed. I've just looked through some code that I thought used them
>>> extensively, but found only two complex literals: 1i (dozens of
>>> instances) and 2i (one instance).
>> 
>> So if D removes complex literals what the proposed name  for Imaginary
>> One would be?
>> _i  ,   i_  ,   _i_,  _I  ,   I  ,   M_I   ?? @i   @j   looks good to
>> me, I'd like even having them both.
>> 
>> Compare code:
>> 0.998f + 2.72e-2fi
>> 0.998f + @i*2.72e-2f
>> 0.998f + 2.72e-2f* @j
> 
> Complex(9.998f, 2.72e-2f)

And if someone *really* wants to put the "i" in there, they can just 
define it in their own app:

  enum i = Complex!double(0, 1);
  auto z = 0.998 + 2.72e-2*i;

-Lars


More information about the Digitalmars-d mailing list