Now think of a proc which expects type B like proc doSomethingWith(b: B) = ....
I can create a converter converter toB(s: string): B = toB(toA(s)) to make the proc accept a string as parameter. But wouldn't it possible to let the compiler figure this out automatically?
I asked a similar question some weeks ago, hoping that smart converters would make it very easy to add GC support to GTK3. From Jehan's answer, it seems that only direct conversion is possible, see
Sounds like macros and meta programming in gerneral :)
The compiler could give a warning where it is used and one could use a pragma to enable this resolution for chosen converters individually, even giving a hint about the direction (input or output) for the connections could be defined and help to reduce such problems.
But then I think it is not to hard to just write the ones I need manually. I just did that tonight with a couple of them and it's pretty nice to have no "other effects" coming in the way and see a clear list of whats available.
template nimobject2gtkwidget(o: NimGtkObj): expr = o.gtkWidget
then gtk3.set_text(nimWidget, "Text") may work. Obviously it is necessary that there exists not more than one of these converters for a data type. The benefit would be that we have to write less glue code for high level wrappers. (Otherwise, we have to write for many library functions a companion proc with a NimObject parameter which calls the library function with the library pointer.)