In this example:
    
    
    import db_sqlite
    type
      Database* = ref object
        db: DbConn
    
    proc newDatabase*(filename = "tweeter.db"): Database =
      new result
      result.db = open(filename, "", "", "")
    
    
    Run

What does the first line of the proc newDatabase() do?

In the following code I've tested I have not noticed anything if I remove the 
"new result" bit
    
    
    type
      T = ref object
        data: int
    
    proc newT(data: int): T =
      new result
      result.data = data
    
    var a = newT(12)
    
    echo a.data
    
    
    Run

Reply via email to