Walter:

Anyhow, D has a lot of facilities for putting things on the stack rather than the heap,

In a system language heap allocations are often among the spots where the program is slower. So a good system language must offer good ways to use the stack as much as possible. D offers some ways to use the stack, but surely there is a good amount of space for improvements, some examples:

1) Some kind of optimization to avoid heap allocations for lines of code like this will improve the situation:
int[3] a = [10,20,30];

2) Some kind of (safer) stack-allocated variable-length arrays are handy (see Ada language too that uses stack-allocated arrays a lot):
http://d.puremagic.com/issues/show_bug.cgi?id=5348

3) Currently emplace has several problems and limits.

4) A compilation switch to list all points where a heap-allocetd closure is created will help avoid unwanted heap usage:
http://d.puremagic.com/issues/show_bug.cgi?id=5070

5 extra) Currently there are no ways to put an immutable associative array on the stack, or as global immutable variable :-) Many of my small associative arrays don't need to mutate after I have created them at the start of the program. Having a way to put them on the stack seems an interesting thing.

Bye,
bearophile

Reply via email to