ref is similar to a pointer except that the garbage collector handles it. if 
you think about how a ref is created 
    
    
    type
      simpleRef = ref simpleObj
      simpleObj = object
    
    
    proc createSimpleRef():simpleRef =
      result = new simpleObj
    
    
    Run

the `new` keyword just allows the GC to allocate space for the `simpleObj` and 
lets it keep track of if it is still being used or can be freed

generally if you are planning on creating an object once and using it in many 
places, i would recommend a `ref` but if you plan on using an object quickly 
say just inside a `proc` then a simple object would do fine

Reply via email to