On Wed, 27 Mar 2013 11:13:31 -0700 "H. S. Teoh" <hst...@quickfur.ath.cx> wrote:
> On Wed, Mar 27, 2013 at 07:06:45PM +0100, Vidar Wahlberg wrote: > [...] > > > > 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" :) Yea, the arrays definitely do blur the value/reference lines. Aside from static/dynamic, another example of this is how a dynamic array's *values* are reference, but it's length is by-value. Of course, it's very simple when you realize that a D dynamic array is more-or-less like this: struct Array(T) { size_t length; T* ptr; } But still, it's definitely something to get used to. > > >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. It was originally designed for scripting uses. But making that work well required adding the feature of "*automatically* detect and compile all required sources". And that feature turned out to be very useful just for its own sake, so RDMD grew into something that could nicely handle both. > > rdmd gives D a scripting-like interface, but D is inherently a > compiled language, so it isn't actually a D interpreter. :) Sure it is! It's an AOT interpreter! (Which is ironically something very well-respected and sought-after in interpreted-language circles. Go figure: they've reinvented native compilation and simply gave it a new name.)