And another way that comes to mind is to use static parameters for types, 
adding them programmatically. A sketch (compiles):
    
    
    type
      # an interface declaration, as should be created via the `interface` macro
      Intf1 = concept o
        "Intf1" in o.interfaces
        # initial concepts body here...
      
      # 2 type declarations, again as should be created by a macro (kind of 
`implements`),
      # given to it a declaration like:
      #   type O = object
      #     x: int
      # and the interface name "Intf1"
      O_decl[interfaces: static[seq[string]]] = object
        x: int
      O = O_decl[@["Intf1"]]
      # type information should be used instead of names (strings)
    
    #macro implements(
    
    proc p(o: Intf1) = echo "ok"
    var o: O
    p o   # -> "ok"
    
    # this shouldn't compile (and doesn't)
    #type O2 = O_decl[@[]]
    #var o2: O2
    #p o2 # won't match
    

Reply via email to