wrote:
> However, Java also has a very mundane, but serious flaw as far as
> numerical computing is concerned: no typedefs. In C++, I like to
> define my floating point type as double or float and only use that
> alias. Now, when I need to switch the precision in all of the program,
> I only change one line.
The first thing I would have mentioned is Java doesn't have operator
overloading, resulting in some very unnatural looking algorithms. But I
guess you have a good point. Treating precision as a strategy, and
plugging in a new strategy as desired, as obvious benefits.
>
> Another issue is having to duplicate certain functions. Let's say you
> are writing a linear equation solver procedure. You might need four
> versions of essentially identical code for float, double,
> complex<float>, complex<double>, whereas in C++, you could just have
> one template.
I wonder if something could be added to Java to handle situations like
these. Not a precompiler or C++ style templates, but say a separate
language (like Simula) that handles specialized tasks. The result
should be byte codes and classes linkable to a Java program, although
perhaps not strictly Java internally. A really fancy specialized
handler could handle equations in more than just ascii text. Proper
sigma for summation, anyone?
Actually I'd be surprised if someone hasn't tried to make something like
this already.