You can ctrl+F it in the manual, but the difference between inheritable and 
RootObj is not that important.

This is just a limitation of the parser, you must not use dot call syntax: 
    
    
    var x: StorageBase
    
    discard Storage[int] x
    
    
    Run

But if you just want cute syntax, you may as well use some metaprogramming not 
to deal with inheritance when it's not neccesary: 
    
    
    template container(T: typedesc, size=100) =
      var `name` = newSeq[`T`] size
      template `@`(typ: typedesc[T]): untyped {.used.} = `name`
    
    container int
    container float
    
    @int[0] = 123
    
    echo @int[0]                  # 123
    echo @int[1]                  # 0
    echo @int.len == @float.len   # true
    
    
    Run

Reply via email to