So I'm just messing around and from what I understand this code should be fine, 
but for some reason I'm getting an error. I am wondering if there is something 
I don't understand about pointers in Nim and how to use them
    
    
    proc newLead[T](oldData:T):Lead =
        #copy the data if the old data is not mutable
        result.desc = T.name
        result.data = alloc0(sizeof(T))
        result.data[] = 10 #THIS is where im getting the error at the `=`, also 
here we are assuming T == int
        echo result.data.repr
        dealloc(result.data) ##this is just to clean up because im testing
    
    
    Run

Reply via email to