Stack vs heap doesn't concern me all that much. Here is an example of code that 
is currently allowed but shouldn't:
    
    
    var heap: cstring
    
    proc cstringEscapes(c: cstring) =
      heap = c
    
    var x = "Nim string"
    cstringEscapes(x)
    

For convenience conversions to cstring are implicit, but only save if the 
cstring cannot escape the proc. The same reasoning can be extended to 
destructors: Only if the file handle does not escape, we need to call the 
destructor. However, here linear typing helps so that the file handle stays 
"unique". There is an important distinction to be drawn between "might escape" 
(concerns for safety) and "does always escape" (so we cannot leak it). 

Reply via email to