First Impressions

Lutger lutger.blijdestijn at gmail.com
Thu Sep 28 18:16:40 PDT 2006


Geoff Carlton wrote:
> Hi,
> I'm a C++ user who's just tried D and I wanted to give my first
> impressions.  I can't really justify moving any of my codebase over to
> D, so I wrote a quick tool to parse a dictionary file and make a
> histogram - a bit like the wc demo in the dmd package.

You'll sure be pleased with D coming from C++.

> 1.)
> I was a bit underwhelmed by the syntax of char[]...

Yes, I was too. But although it looks not very nice at first sight, D's 
arrays are nothing like C++ arrays. Strings are first class, array 
notation is consistent and getting used to them together with 
concatenation and slicing operators, I found they are quite powerful yet 
simple to use.

> 2.)
> I liked the more powerful for loop.  I'm curious is there any ability to 
> use delegates in the same way as lua does?  I was blown away the first 
> time I realised how simple it was for custom iteration in lua.  In 
> short, you write a function that returns a delegate (a closure?) that 
> itself returns arguments, terminating in nil.

You can enable a class to use the foreach statement. 
http://www.digitalmars.com/d/statement.html#foreach

> 4.)
> The D version of Scintilla and d-build was nice, very easy to use.
> Personally I would have preferred the default behaviour of dbuild to put 
> object files in an /obj subdirectory and the final exe in the original 
> directory dbuild is run from.
> 
> This way, it could be run from a root directory, operate on a /src 
> subdirectory, and not clutter up the source with object files.  There is 
> a switch for that, of course, but I can't imagine when you would want 
> object files sitting in the same directory as the source.

Check out build: http://www.dsource.org/projects/build

> Well, as first impressions go, I was pleased by D, and am interested to 
> see how well it fares as time goes on.  Its just a shame that all the 
> tools/library/IDE is all in C++!
> 
> Thanks,
> Geoff





More information about the Digitalmars-d mailing list