3 ms·
What if you want to make two languages cooperate? If they both have their own GC, then you can't garbage collect across language boundaries, which can be annoyi
by amelius 5y ago
What if you want to make two languages cooperate? If they both have their own GC, then you can't garbage collect across language boundaries, which can be annoying. I think this is similar to the microservices debate, where you have either one big transactional database or a bunch of disconnected ones where committing a transaction involving multiple services becomes increasingly difficult.
- throwaway894345 5y ago> What if you want to make two languages cooperate? If they both have their own GC, then you can't garbage collect across language boundaries, which can be annoying. I think this is similar to the microservices debate, where you have either one big transactional database or a bunch of disconnected ones where committing a transaction involving multiple services becomes increasingly difficult. This is an interesting observation. I think in both cases the ideal of having one large system remains elusive and the more robust, practical solution is RPC (basically more, smaller control loops rather than a single larger control loop). To abstract this out even further, I've noticed that this seems to be a common pattern in reliable distributed systems are architected--from Erlang's OTP to Kubernetes' controller approach. I'm actually really surprised this "controller" or "control system" architecture vs monolith architecture isn't discussed more frequently, at least in terms of reliability tradeoffs.
- pjmlp 5y agoYou have GC APIs at the FFI level to let runtimes communicate and pin references across runtimes. D, Java and .NET provide such APIs.
- amelius 5y agoBut do these runtimes allow circular references across language boundaries?
- pjmlp 5y agoHow do you think something like mixing .NET and COM/UWP libraries work? By mixing GC with the reference counting of pining such references. Naturally you can get the reference count wrong. Still much better than just doing plain old manual memory management, as those are corner cases, while with manual memory management every allocation is a possible leak. Incidently this scenario was exacly one of the ones presented at why Linear Haskell (JVM/Haskell interoperability) by Tweag at the recent functional programming languages conference.