On Wednesday, 15 January 2014 at 08:54:51 UTC, Rainer Schuetze
wrote:
std.emplace can be used on a partial memory block (e.g. as part
of a struct), so you will have to add the emplaced type info in
addition to the outer struct's type info. There can be multiple
areas with emplaced dta within the same memory allocation, too.
This is a good point. It is a mistake to mix manual memory layout
and byte-level control with an obligatory GC regime. Those
optimizations should either be done automatically by a high level
optimizer, triggered by compiler hits, or be non-GC. Basically,
one has to decide whether to focus on high level or low level for
heap allocations.
D is by design a high-level effort with low-level access bolted
on everywhere. That undermines the premises for efficient
high-level implementation. I think you either have to restrict
the low level to the non-GC-heap-allocations and inner loops at
the leaves of the call-tree, or start with a low level language
design and very carefully add optional high level constructs.
High level as the default with low level control interspersed
everywhere makes high level optimization intractable.