Hacker News new | ask | show | jobs
by tidwall 70 days ago
Looks to me like having the ability to write Go syntax and interop directly with C is the plus.
4 comments

I do like Go's syntax but I can't help thinking the best language for C interop is C.
> I do like Go's syntax but I can't help thinking the best language for C interop is C.

SWIG[0] is a viable option for incorporating C code as well.

0 - https://swig.org/Doc4.4/Go.html#Go

I love how SWIG is still around! I first used it about 30 years ago to integrate with Perl, then later with Java.
>having the ability to write Go syntax and interop directly with C is the plus.

It's always a plus to interop with the lingua franca of programming languages.

I think D language approach is more organic and intuitive that you can interop directly, and now that it's natively supported by the D compiler make it even better [1],[2].

[1] Interfacing to C:

https://dlang.org/spec/interfaceToC.html

[2] Adding ANSI C11 C compiler to D so it can import and compile C files directly (105 comments)

https://news.ycombinator.com/item?id=27102584

Go's syntax is basically C tho lol

what's the benefit? for loops?

if you're forgoing go features to get c interop anyway, why not just roll back to whatever go version gccgo supports at that point?