Just if anybody wants / needs to know how to modify @Krux02 original code to 
automatically use a converter and therefor hiding more of the implementation 
details.

Simply replace the lines from `let castIdent = ...` to the end of the file with:
    
    
    # instead of let castIdent = ...
      let converterIdent = newIdentNode($interfaceName.symbol & "Converter")
      
      result.add quote do:
        converter `converterIdent`(this: var `implementationCandidateName`) : 
`interfaceName` = `interfaceName`(
          objet : this.addr,
          vtable : `vtableValueSymbol`.unsafeAddr
        )
    
    

The example can simply call `foobar(a)` and `foobar(b)` after this modification.

Reply via email to