3 ms·
Dammit, now I can't think about anything else but how to design such a protocol, and how to generate adapters which translate between this protocol and the API
by adwn 6y ago
Dammit, now I can't think about anything else but how to design such a protocol, and how to generate adapters which translate between this protocol and the API of a library...
Edit: From the perspective of the interop protocol, it wouldn't make much difference if the library runs in the same address space or in a different process. Large blobs of data, like an picture or a long string, could be passed via pointers (in the same process) or via shared memory (in different processes).
- asdfman123 6y agoIf you're trying to make an API for all programming languages, aren't you essentially just recreating something like the Java virtual machine but with your own biases and assumptions inserted?
- adwn 6y agoYou're misunderstanding my idea. Don't think "C ABI with higher-level types and objects", think "HTTP with more structure".
- asdfman123 6y agoBut it seems that kind of protocol would just be a way of telling a computer what to do, not how to do it. How would that be better than any other messaging format that exists? Genuinely curious, because I don't fully understand this myself but the idea is interesting.
- adwn 6y agoTo be honest, I don't know. It was just a quick idea, and I'm increasingly less sure, whether it makes sense at all. Sorry to disappoint you :-(
- twic 6y agoRight, a way to broker requests between objects. Just a common architecture for that.
- adwn 6y agoExactly! But I don't know how to do that without either a) creating yet-another-standard which nobody supports, or b) requiring just as much effort as providing a C-based API for a given library.
- amelius 6y agoHave a look at how Python programs can call C functions (you can load a dynamically linked library in Python): https://docs.python.org/3/library/ctypes.html https://docs.python.org/3/library/ctypes.html You can store and manipulate C pointers within Python. The other way around should also be possible: manipulate references to Python objects from within C. I suppose this could be extended to Java objects, etc., and it could be based on a single API.