Ants AI, language matters

Marco Leise Marco.Leise at gmx.de
Sun Dec 25 16:06:32 PST 2011


I posted about this contest in D.learn, so it was expectable that people  
try out D there without a good feel for the language and its shortcuts.  
Rank 439 is respectable, but I hoped for a higher ranked D entry.

I don't know if there should to be an optimized boolean matrix in Phobos.  
Is this a construct that is often needed? Is bool[][] just good enough?  
All together I think this source code isn't very informative, but it is an  
example of someone who misses some of the rather obvious features of D,  
like vector operations and foreach. This is all documented somewhere,  
probably not easy to stumble over, yet I think chatting with helpful  
people is the best way to learn by example. Sometimes programming topics  
were discussed on #aichallenge, but then again mostly about  
C++/Java/Python, the most used languages in the contest.

In the list of D2 users (showing those who submitted a program in D as  
their last upload)  
(http://aichallenge.org/language_profile.php?language=D) there are many  
who did only upload one or two programs in D in the whole two months.  
Usually that means they just uploaded the starter bot or a slightly  
modified version. So from the 24 people only 8 active participants remain.  
This is not much different from other languages though.

When I proposed D in the chat, I found that it was generally well received  
now, with many of the legendary issues fixed. What kept some people from  
trying D were:
- a small standard library (the upcoming curl wrapper is one good addition)
- a GC (when they were used to manual memory management)
- C++11

People from interpreted languages that wanted to improve the performance,  
looked more into C/C++, and frankly I know that you have to profile your D  
code now and then. foreach vs. array slice assignments, BigInt and other  
features can be slower than in Java, Perl or other, older languages. In  
this situation I can't tell them to use D, although it is a compiled  
language. Another point is that C++ users usually don't miss the D  
features that they don't know about and C++11 seems good enough to them. I  
don't know how to present contract programming in a chat without going to  
lengths and looking like a fan boy. D's arrays and associative arrays are  
usually a good starting point though. Note that the contest so far didn't  
allow multi-threading (except for runtime threads).

When "modern convenience" and "native performance" meet, I think more  
people will see D as the alternative to Java and C++. This will take some  
time with the GC, the code gen and Phobos.


More information about the Digitalmars-d mailing list