I really like the proposal, but I may not fully understand the core idea ;). 
What exactly do you mean by:

> In a release build the RC operations can be left out and with a type based 
> allocator we still have memory safety!

Does this refer to memory safety as in "no memory leaks" or as in "no memory 
corruption"? I always thought it is the latter.

What would happen for instance in this example:
    
    
    var n: owned Node = fromSomewhere()
    let dangling = unowned(n)
    
    if random() > 1e5:
      # imagine lots of code here
      dangling = nil
    else:
      # imagine lots of code here
      # but programmer forgets to remove the unowned ref
    
    # reassignment => free old owned Node
    n = Node(data: 4)
    
    if not dangling.isNil():
      echo dangling.data
    
    
    Run

In a debug build, the reassignment would lead to an abort if we ever execute 
the unlikely branch that forgets to remove the ref. But in a release build the 
last line would read corrupted memory, wouldn't it? Just because it points to 
memory of the right type, it doesn't mean that it is not an issue?

Reply via email to