Generic and fundamental language design issue
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Nov 4 09:41:17 PST 2012
On 11/4/12 12:35 PM, Tommi wrote:
> I have a fundamental language design talking point for you. It's not
> specific to D. I claim that, most of the time, a programmer cannot, and
> shouldn't have to, make the decision of whether to allocate on stack or
> heap.
I don't think that claim is valid. As a simple example, polymorphism
requires indirection (due to variations in size of the dynamic type
compared to the static type) and indirection is strongly correlated with
dynamic allocation. Also, the value vs. reference semantics of type are
strongly correlated with where objects should go. So on the contrary,
quite often heap vs. stack allocation is forced by the nature of what's
allocated.
Andrei
More information about the Digitalmars-d
mailing list