Adding Unicode operators to D

Bill Baxter wbaxter at gmail.com
Sat Oct 25 15:05:51 PDT 2008


On Sun, Oct 26, 2008 at 5:10 AM, bearophile <bearophileHUGS at lycos.com> wrote:
> Bill Baxter:
>> On the other end there are the Matlab and NumPy-type solutions.  They
>> are convenient for tinkering around and displaying some results, but
>> these are not good for performance.
>
> I have seen many scientific programs that use numpy, so sometimes it's fast enough. But it forces you to write everything in a vector programming style, that a procedural programmer needs time to learn. Normal C/D/C++ code is more flexible, you can work on single items too in a fast way, while in numpy you can go fast only when you work in bulk, on vectors.

Yep  C/D/C++ is easier.  The SciPy.org site has a growing section of
their wiki devoted to how to make your code fast using various levels
of python/native hybrids.  I was using python heavily for numerical
stuff for a while and it got to the point where I realized that the
time I spent trying to figure out how to vectorize things and use
other tricks to make things fast, and to make python modules out of
external code I wanted to call,  etc.  was actually more work than it
would be to just use D for everything.   Sure Python does have some
nice features as a language that D lacks, but from 10,000 ft  D is a
lot closer to Python than C++ in terms of ease of use.  Also, while
Python is nice for arrays and number crunching, I found the lack of
typing to be a liability when it comes to complicated graph
structures.  Instead of nicely typed pointers that the compiler can
tell apart, you end up with 23 different integer index variables that
you have to keep straight.  And finally, also type related, there's
the annoyance that you have to actually run your app to detect typos.

I'm sure there's way's to work around all those issues, but to me D's
a lot easier.  I simply don't need the workarounds.

I still fire up NumPy and Matplotlib for analyzing the from results
from my D programs.  And SymPy is great too.  I just don't use it as
my main development langauge any more.

> On the other hand numpy offers you some higher level operations on arrays that are currently missing in D, like certain complex slicing operations, that may reduce your code length significantly, increasing code readability (because it looks more like formulas); I can show you some examples if you want.

No thanks!  Been there, done that!

> Note that in D there's no built-in rectangular dynamic arrays, that are basic stuff in numpy/matlab.

I've got my dflat and gobo
(http://www.dsource.org/projects/multiarray) that are working for me
pretty well.  They could use some full-time loving to make more
operations work intuitively, but the basics work ok.

--bb


More information about the Digitalmars-d-announce mailing list