null references redux + Looney Tunes
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Oct 4 16:50:26 PDT 2009
Justin Johansson wrote:
> Andrei Alexandrescu Wrote:
>
>> Nick Sabalausky wrote:
>>> "Justin Johansson" <no at spam.com> wrote in message
>>> news:haavf1$2gs7$1 at digitalmars.com...
>>>> It's a difficult challenge to get high performance, readable and
>>>> maintainable code out of complex number
>>>> intensive algorithms. Use of library types for complex numbers has, in
>>>> my experience been problematic.
>>>> Complex numbers should be first class value types I say.
>>>>
>>> There's been discussion before (I can't find it now, or remember the name
>>> for it) of type systems that allow for proper handling of things like m/s
>>> vs. m/(s*s) vs inch/min etc. I haven't actually worked with such a feature
>>> or with complex/imaginary numbers in any actual code, so I can't be sure,
>>> but I've been wondering if a type system like that would be an appropriate
>>> (or even ideal) way to handle real/complex/imaginary numbers.
>> It better be. Complex numbers aren't that complicated of a notion.
>> What's lost in pulling them out of the language is the ability to define
>> literals.
>
>> "Now please name five remarkable complex literals."
>
> (re, im) ::= (0, 0), (1,0), (0,1), (1,1), (pi/2, 0), (0, pi/2), e_to_the_power_(minus j),
> e_to_the_power_(minus j * pi/2)
>
> Is that what you mean?
(Three of those are real.)
What I meant was that complex literals helped by syntax are seldom
likely to improve code quality. Many numeric literals are of
questionable taste anyway and should at best defined as symbols. I don't
see why complex literals shouldn't follow the same recommendation.
Andrei
More information about the Digitalmars-d
mailing list