Hacker News new | ask | show | jobs
by jsjsjsjsjsjs 2552 days ago
> - Nim: C/C++ interop is second to none.

This is very wrong.

There is perfect c interop - you can import c functions using {.importc.} pragma.

C++ interop is best i have seen so far. You can use c++ template types! Here is the sample: https://github.com/3dicc/Urhonimo/blob/master/modules/contai... Of course it is not perfect. For example if you would like to override c++ method you will have to write a bit of c++ code using {.emit.} pragma. I do not know a single language that could map c++ template types into it's own generic types like nim can.

3 comments

"second to none" means "best" ("there is no one it is second to, thus it is first")
TIL. Not native english-speaker. My bad.
You made my point better though! Nim interop is awesome.
D's C++ interop looks better at a glance.

With a simple extern(C++) you can use templates, classes and vtable's are matched up to single inheritance. There is also some experimental work on catching C++ exceptions but I've never tried to use it.

Also: COM support. This can be incredibly useful for interop.
Specially since Windows has gone full COM for all new major APIs.
"second to none" means "the best".