My thoughts & experiences with D so far, as a novice D coder

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 27 11:13:31 PDT 2013


On Wed, Mar 27, 2013 at 07:06:45PM +0100, Vidar Wahlberg wrote:
[...]
> >Yea, I'd imagine there would be some value-type/reference-type
> >confusion from a lot of newcomers just because D *has* both value
> >types and reference types. As opposed to, say, Java where (almost?)
> >everything is a reference type, or C++ where everything is a value
> >type, etc.
> >
> >Personally, I find it very much worthwhile to have both value and
> >reference types. But you're right it is something many people will
> >have to learn to get used to, and particularly so with arrays.
> 
> I find it quite nice that you have both value and reference types, and
> for the most part it's rather clear in D when you're dealing with a
> reference and when you're dealing with a value. It was just arrays
> that caught me off guard, and I think others with a similar background
> may do the same mistake, so my comment about this really just is
> "arrays may require more explanation aimed at Java developers" :)

Yeah, the documentation needs to be improved. Maybe file an enhancement
bug for this at d.puremagic.com/issues ?


> >But D has an easy solution - just use RDMD instead:
> >
> >rdmd --build-only -I{include paths as usual} {other flags} main.d
> 
> That's a good tip! Somehow I had the notion that rdmd was purely a
> tool for "scripting", as in dynamically parsing code (like Python,
> Perl, etc), so I never looked much into it.

rdmd gives D a scripting-like interface, but D is inherently a compiled
language, so it isn't actually a D interpreter. :) It's just that D
compilation (esp. with DMD) is incredibly fast, given what it does, so
that calling rdmd is almost like "interpreting" D code on-the-fly.

What it actually does, of course, is to compile the code and cache the
compiled objects, so running it multiple times does not repeatedly incur
the compile-time overhead.


T

-- 
Caffeine underflow. Brain dumped.


More information about the Digitalmars-d mailing list