On 11/4/2012 3:20 PM, Tommi wrote:
It's great that optimizations could be used to eliminate unnecessary heap allocations. But it could be interesting to imagine a language where it was impossible for the programmer to explicitly specify the allocation method. Things would go to heap if it was determined necessary by compile-time analysis, and also when the heuristics determine there might a danger of stack overflow. Otherwise things would go to stack. Pointers (or rather re-directable references) would always be used for referring to existing variables (that could be on heap or not). Pointers would never represent "a variable allocated on heap".
That's what Java does today.