Eigenpoll : D wish list : Reallocation Keyword
One of the few things I think missing in modern programming languages is a keyword for reallocating memory. Sure, you could use a dynamic array. But sometimes, the built-in array types just aren't enough and you have to 'cheat', use pointers / manual allocation.
The current design for memory reallocation requires allocating a new block of memory, copying all of the old data over, and freeing the old block of memory.
I like keywords to be a little unusual. I don't like 'resize' or 'realloc'. There is one keyword which I really like though: 'Renew'.
int* ptr = new int[5];
renew [10] ptr; // The syntax can be similar to delete
renew [3] ptr; // It can also shrink memory
Report this item for cleanup