🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

different language servers talking via zeroMQ

Started by
2 comments, last by Awoken 5 years, 2 months ago

Is it possible?
For instance, could I write my path-finding functions in a more powerful language than JavaScript and use it as a back-end server and then have my Node.js server request 'path' info from it and then the front-end Node.js server would use that data.  I guess like multiple concurrent servers written in languages that are better suited for the specifics of the server's task?

Advertisement

ZeroMQ is a messaging protocol and a network library. If you have a ZeroMQ library for JavaScript, and a ZeroMQ library for some other language, then yes, those systems can send messages to each other.

Is this a good idea? In my experience, no. You'll want as much of your code as possible in a single language (or at least "single environment") because otherwise you have to keep two copies of all the important data structures, and keep them in sync, Plus you end up with two vector math libraries, two collision testing implementations, two database client libraries, and so on, and they will differ in implementation in ways that will cause ongoing confusion.

This is why Microsoft built the CLR as a "runtime for many lanaugages" -- you can use the same data structures defined in C# for a program written in F#, or Visual Basic.NET, or C++/CLR. Oracle was late to the party with JVM languages; most of the languages that "target the JVM" are third-party languages (Scala, Kotlin, Clojure) but they do have some of the same benefits where you can import functions and data structures across languages.

Anyway: Yes, the benefit of network protocols, is that you don't need to know what the specific implementation is on the other side of the protocol. The draw-back of network protocols is that all involved parties need to implement them the same, or subtle (or not-so-subtle) bugs will ensue.

enum Bool { True, False, FileNotFound };

thank you.

This topic is closed to new replies.

Advertisement