If you could make any changes to D, what would they look like?

Adam Ruppe destructionator at gmail.com
Fri Oct 29 21:56:10 UTC 2021

On Friday, 29 October 2021 at 21:16:49 UTC, H. S. Teoh wrote:
> Long story short, pureFree makes no sense

What about:

void foo() pure {
    int* a = malloc(5);
    scope(exit) free(a);

How is that any different than

void foo() pure {
    int[5] a;


I expect that's how it is actually used. (Perhaps it would be 
better encapsulated in a function along the lines of:

void foo() pure {
     workWithMemory((int* a) {

     }, 5);

And then the malloc/free could be wrapped up a bit better)

More information about the Digitalmars-d mailing list