If I understand you correctly, you wanted the client/user of the module to 
provide their own initElement proc of their type, didn't you?

In that case, you're able to ensure the compiler to check whether the user 
provide their own initElement using 
[compile](https://nim-lang.github.io/Nim/system.html#compiles%2Cuntyped) proc.
    
    
    proc foo[T]: T =
       when not compiles(initElement[T]()):
            {.error: "please provide initElement proc for your type".}
       result = initElement[T]()
    
    
    Run

Reply via email to