Some questions ....
    
    
    var n: NodeIdx = fromSomewhere()
    var dangling = n  # what type gets dangling? unowned ref mut NodeIdx? e.g...
    dangling.data = 777   # allowed? or....
    dangling[].data = 777 # allowed?
    
    if random() > 1e5:
      # imagine lots of code here
      dangling = -1
    else:
      # imagine lots of code here
    
    # reassignment => free old owned Node
    a[n] = Node(data: 4)  # where comes the "a" from? And the n is used as an 
index?
    if dangling >= 0:
      echo a[dangling].data
    
    
    Run

Reply via email to