Input from a newbie

bearophile bearophileHUGS at lycos.com
Sat Apr 7 16:58:17 PDT 2012


Jonas:

> Hello D community! :-)

Welcome here.


> I was looking for a sane, object-oriented, 
> possible-to-go-low-level programming language, so I decided to 
> give D a try today.

D supports OOP well enough, but template-based programming seems 
equally fit or even more. Also keep in mind that the D GC is not 
so efficient, so avoid creating too many small objects, as you do 
in Java.


> 1) First off, I really couldn't figure out were I was supposed 
> to post this sort of message.

This is the right place.


> 2) I couldn't find any good documentation on the build process 
> and tools I'm supposed to use. Do you guys use standard 
> Makefiles? Do you have your own build system? Would be really 
> helpful if that was covered on the website.

One tool fit for not huge programs is rdmd. I use "bud" still, 
but it's getting obsolete.


> 3) While your error messages are a lot better than GCCs (gives 
> you more context, hints about how the compiler interpreted your 
> buggy program, etc) it wouldn't hurt if you made them a bit 
> more graphical using colors and markers and such (LLVM like).

I don't think Walter will love this idea.


> 4) What's the difference between `... foo(MyObject obj) { ... 
> }` and `foo(MyObject* obj)`?

If obj is a class instance, then the first syntax is the one you 
will find in D programs.


> What are use cases for explicit pointers when passing objects? 
> That's not covered in the documentation AFAIT.

It's not documented because you don't use explicit pointers to 
pass objects around. Pointers are used to pass structs around 
when you don't want to copy them.


> 5) What's wrong with this program? Is it that `printf` doesn't 
> understand D strings? If so, how do I use D strings in string 
> formatting?

Use write, writef, writeln, writefln for D strings and for 
several other D data structures.

Take a look here for many small examples programs in D to do many 
different kind of things (not all of them are up to date or fully 
correct, but most of them are good, and the wrong ones are being 
fixed one after the other):
http://rosettacode.org/wiki/Category:D

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list