On Thursday, 19 December 2013 at 12:49:55 UTC, Francesco Cattoglio wrote:
On Thursday, 19 December 2013 at 11:22:59 UTC, Maxim Fomin wrote:
void main()
{
  immutable int* ptr = foo();
  writeln(*ptr); // it is 0
  GC.collect();
  writeln(*ptr); // it is 1 now
}

Your proposal suffers from same issue. Although idea of unique can be worthy, without escape analysis it is another hole.

Wow... that looks really unsettling.
But as far as I can tell, you are declaring an immutable pointer, and the pointer itself never changes. After all, this looks correct. Or am I missing something from the language specifics?

Actually it is fully immutable, which means that both pointer and pointee are fixed. This is not the case and that's why it is a hole.

Reply via email to