Your example isn't generic.

Replace this 
    
    
    proc text*(page: var Page, text: string): void =
      page.page.add (text: text).to_json
    
    proc image*(page: var Page, data: JsonNode): void =
      page.page.add (image: data).to_json
    
    
    Run

with this 
    
    
    proc text*[T:Page](page: var T, text: string) =
      page.page.add (text: text).to_json
    
    proc image*[T:Page](page: var T, data: JsonNode) =
      page.page.add (image: data).to_json
    
    
    Run

and it should work. Also the void return type is completely unneccesary. It's 
the default return type.

Or you could replace 
    
    
    import plot, json_helpers
    
    
    Run

with 
    
    
    import json_helpers
    include plot
    
    
    Run

in main.nim.

However the order is important in this case and plot will only compile when 
included in another file that already imports json_helpers.

Reply via email to