16
Programming / Re: D language - class
« on: November 16, 2014, 11:50:14 PM »
While the answer to your syntactical question is simply "because that's the way D syntax works", the answer to your implementation question about class memory allocation may have more of an answer:
I was completely unfamiliar with D (other than being aware that it exists), so I did some investigation and found the following:
http://forum.dlang.org/thread/juspoa$5g9$1@digitalmars.com#post-juspoa:245g9:241:40digitalmars.com
http://dlang.org/deprecate.html#scope%20for%20allocating%20classes%20on%20the%20stack
http://wiki.dlang.org/Memory_Management
https://issues.dlang.org/show_bug.cgi?id=5270
Short answer seems to be: D used to allow classes to be allocated to the stack, but deprecated this option because it caused memory corruption in some circumstances.
I was completely unfamiliar with D (other than being aware that it exists), so I did some investigation and found the following:
http://forum.dlang.org/thread/juspoa$5g9$1@digitalmars.com#post-juspoa:245g9:241:40digitalmars.com
http://dlang.org/deprecate.html#scope%20for%20allocating%20classes%20on%20the%20stack
http://wiki.dlang.org/Memory_Management
https://issues.dlang.org/show_bug.cgi?id=5270
Short answer seems to be: D used to allow classes to be allocated to the stack, but deprecated this option because it caused memory corruption in some circumstances.