4 ms·
GHC can produce native libraries just like C or Rust.
by vapourismo 8y ago
GHC can produce native libraries just like C or Rust.
- reikonomusha 8y agoBut you carry around a runtime with managed objects that can’t be freely traded across the boundary to C libraries.
- vapourismo 8y agoCertainly it isn't the most attractive solution - still it is possible and works well. When it comes to moving things across FFI barrier, that is also very possible as there are all kinds of types (including stable pointers) in the Foreign.* modules that map onto C types.
- wtetzner 8y agoBut you have to link in the runtime, including the garbage collector.
- vapourismo 8y agoI don't see how that is a big problem.
- jeffdavis 8y agoIt's a larger footprint, possibly drains battery when you don't expect, may mess with signal handlers and other global state. And it does not really scale to many libraries. What happens when eveyone thinks theor language is best and wants to link in a big runtime? You need 30 different runtimes for 30 libraries? Ouch. And if not careful about versioning, you could end up with symbol conflicts, etc. All these problems can be overcome, but are just not acceptable if you want to be a ubiquitous library like libjpeg. Needs to be super simple from a runtime perspective.
- wtetzner 8y agoNot to mention trying to get different garbage collectors to play nicely together.