Fixing the imaginary/complex mess
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Mon Jun 13 07:51:52 PDT 2011
On Mon, 13 Jun 2011 08:36:32 -0500, Andrei Alexandrescu wrote:
> On 6/13/11 6:36 AM, Robert Clipsham wrote:
>> I seemed to think the plan for complex numbers was to do what happened
>> with associative arrays, that is, keep the language syntax, but have
>> the feature implemented in the library. Is this not the case?
>
> No, the current vision is to completely replace complex with library
> artifacts. Walter wants to keep the "i" postfix as a hack, but I think
> that's completely unnecessary.
>
> A complex() convenience function should be useful. If anyone has the
> time, please create a pull request. It should never automatically create
> Complex with an integral type, as bearophile mentioned. For the rare
> cases where complex is needed with integrals, it should be fine to use
> Complex!int etc. directly.
Sure, I'll add complex().
Regarding Complex!int: I have explicitly restricted Complex to floating-
point types. Here is a message I sent to the Phobos mailing list,
explaining why:
http://lists.puremagic.com/pipermail/phobos/2010-April/000286.html
See also Don's reply to that message, it really drives the point home:
http://lists.puremagic.com/pipermail/phobos/2010-April/000287.html
-Lars
More information about the Digitalmars-d
mailing list