In addition to what _BigEpsilon_ says, if you want to instantiate it that way, 
you may use a template for not creating an additional variable explicitly each 
time and to fit all in one initialization:
    
    
    template ofType(typ: typedesc): auto =
      var x: typ
      x
    # usage
    var my_text : TextBuffer = (position: (25.0, 25.0), cursor: (0,0), 
glyphPositions: ofType(GlyphArray), linePositions: @[(0,0)], text:"")
    echo my_text.repr
    

Or to name it, say, `makeVar`, for calling then `GlyphArray.makeVar`.

Of coarse you can make individual no-arguments templates to call them like 
`instGlyphArray()`, just you'll need then to define them per-type.

Yet you can define a constructor/initialization proc for whole the TextBuffer - 
maybe some initialization values (say, cursor) are usually the same, or can be 
calculated, then you won't need to provide them each time, that is you'll use:
    
    
    var my_text: makeTextBuffer(onlyNeededArgsHere, inAnyDesiredOrder)
    

Reply via email to