hoprd is implemented in Typescript and runs using Nodejs. The choice of Typescript and Nodejs was made to be as flexible as possible in the future in terms of running hopr on mobile devices, embedded devices or a web browser.
However, the platform choice can be problematic for system server software like hoprd because of the constraints of both Typescript and Nodejs.
In comes WebAssembly which has become a widely supported standard, can be run in web browsers and Nodejs alike. That also means software which can be compiled into WebAssembly can be integrated with existing Typescript/Nodejs software. This opens up the opportunity to use other programming languages which might lend itself more towards implementing concurrent system software while retaining the ability to run within web browsers.
Such an integration can be a step-by-step process where parts of hoprd are gradually implemented in some other language while still running on Nodejs. Only at the end the whole of hoprd could then be switched off Typescript and Nodejs if desired.
Thus, I would like to open up a discussion for suggestions of programming languages, including pros and cons of their use for hoprd.
The main requirement is the ability to target WebAssembly.
When I read WebAssembly (WASM), I smell Polkadot/Kusama.
And I am 100% convinced that this is where the music plays during the next years.
So a big thumbs up from my side!
Proposal for using Golang to build components for hoprd.
Advantages
very simply language, easy to learn for newcomers
memory-safety at the core of the language
statically typed
great documentation
good standard library
includes basic concurrency features like Mutex, Queue, etc
gofmt
frequently used in the crypto space
lots of experienced Golang systems developers out there
Disadvantages
package management is Git-based and uses vendoring
this is mostly a subjective view though
hard to follow releases in deps
repositories get bloated easily
concurrency via goroutines (CSP) is useful, but quite a different model than traditional approaches and requires careful send/receive handling
large resulting binary sizes, which might not be as problematic for server applications like hoprd
What does Golang offer over Javascript/Typescript?
I believe Golang is superior in every aspect to JS/TS for the use-case of hopr. Its still fast to work with due to the simple language features but serves the server-oriented programming model better. Its simplicity might lead to more verbose code, but I don’t consider this a big drawback.