[phobos] std.complex: ready for Phobos?

Philippe Sigaud philippe.sigaud at gmail.com
Tue Apr 20 13:04:01 PDT 2010


On Tue, Apr 20, 2010 at 11:06, Lars Tandle Kyllingstad
<lars at kyllingen.net>wrote:

> Does Complex!BigInt (or Complex!int, for that matter) *ever* make sense?  I
> mean, yes, it *sounds* cool, and I'm normally against introducing gratuitous
> constraints on functionality, but in this case I think I prefer restricting
> T to real number types.
>
> Have in mind that not only will one have to disable (or introduce special
> cases for) abs() and arg(), but also some of the operations, in particular
> division and exponentiation.
>
> It all sounds like more work, more maintenance, more complex code (hur
> hur), for very little or no benefit.
>
>
I completly agree, and wasn't trying to sell Complex for any integral type!
My only suggestion was to use a generic template to determine what operators
were supported by a type, based on your suggestion to use compile-time
interfaces, à la std.range.
I was using BigInt as non-built-in numeric type, the only one available on
Phobos.

But then I thought that the compiler already checks at compile-time that the
operations are possible, so I'm not so certain about the need for such a
template. Maybe as a way to document the code?

Sorry for the noise, I'll let you continue your good work.

Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100420/bb81b9a4/attachment.html>


More information about the phobos mailing list