6 ms·
I write libraries. In Go I can only write libraries for Go programs. In Rust I can write libraries for any program. i.e. Rust can easily produce static and dy
by pornel 10y ago
I write libraries.
In Go I can only write libraries for Go programs. In Rust I can write libraries for any program.
i.e. Rust can easily produce static and dynamic libraries that are linkable with C programs and any language with a C FFI. I can write Rust code that works for programmers using C, C++, C#, D, Go, Swift, Python, PHP, Java, etc.
- shanemhansen 10y ago> In Go I can only write libraries for Go programs. That's not true. It's quite simple to create a loadable shared object in go and call it using anything with a c ffi.
- TheDong 10y agoIt's not quite simple because of the GC go brings. As proof, notice that it barely happens, and only as an oddity in Go, yet in rust there are actual uses (e.g. ruby and python library optimization)
- lobster_johnson 10y agoCalling C from Go has significant overhead [1], doesn't that mean calling Go from C is equally slow? [1] https://www.cockroachlabs.com/blog/the-cost-and-complexity-of-cgo/ https://www.cockroachlabs.com/blog/the-cost-and-complexity-o...
- hueving 10y agoIt may be even worse calling Go from C since you are bring the whole Go runtime with GC and all when you call into Go.
- thegeekpirate 10y agoYou can do this with Go as well, and have been able to for a while now. http://www.darkcoding.net/software/building-shared-libraries-in-go-part-1/ http://www.darkcoding.net/software/building-shared-libraries... http://blog.ralch.com/tutorial/golang-sharing-libraries/ http://blog.ralch.com/tutorial/golang-sharing-libraries/
- Zardoz84 10y agoLike Dlang