On Sunday, 19 August 2012 at 17:58:03 UTC, Thiez wrote:
On Sunday, 19 August 2012 at 09:28:49 UTC, Paulo Pinto wrote:
Oh, and forgot to mention that structs wouldn't be allocated
in stack anyway, even with a JVM's implementation for safe D,
thus breaking language's semantics.
The reference page on structs http://dlang.org/struct.html does
not appear to contain the word 'stack' at all. It seems to me
placing structs on the stack would only be important when
interfacing with C, but I don't think it would matter
otherwise; as long as the destructor is called when the struct
goes out of scope, why should the memory location make any
difference?
Language semantics should stick to defining what should happen,
not how it should happen.
It is described in the TDPL book.
It is important because it influences the amount of memory a
program may use, and hence invalidate the usability of an
algorithm that depend on how the memory is used. Memory location
has as side effects cache location, and access time.
--
Paulo