d

Vectors and dynamic arrays in D

I was thinking that dynamic arrays were a replacement for vectors in D, but it seems they have no remove function (only associative arrays do) which is rather a limitation for a vector so I'm wondering if I've got that right. If a have an array like follows, uint[] a; a.length = 3; a[0] = 1; a[1] = 2; a[2] = 3; Then the only way I've ...

How to print the string's representation of an object in D?

I'd like to do something equivalent to Python's repr: >>> x = "a\nb\nc" >>> print x a b c >>> repr(x) "'a\\nb\\nc'" >>> print repr(x) 'a\nb\nc' How can I do that in D? Is there a format directive similar to Python's %r? EDIT: I want to be able to print strings in their escaped form for debugging purposes (I've just started to learn...

Stack-based object instantiation in D

I'm learning D, and am confused by an error I'm getting. Consider the following: module helloworld; import std.stdio; import std.perf; ptrdiff_t main( string[] args ) { auto t = new PerformanceCounter; //From managed heap //PerformanceCounter t; //On the stack t.start(); writeln( "Hello, ", size_t....

Erlang style concurrency in the D programming language.

I think Erlang-style concurrency is the answer to exponential growth of core count. You can kind of fake it with other main stream languages. But the solutions always leave me wanting. I am not willing to give up multi-paradigm programming (C++/D) to switch to Erlang's draconian syntax. What is Erlang-style concurrency: From one of ...