Following up on my previous posts where I was testing basic async servers and such. I've almost done porting my companies firmware over to Nim based on the `nesper` library.. and it's great!
The firmware is about 10k lines of Nim code (~2.2k lines in the app and ~8.7k being the Nim imports for the various esp-idf C/C++ libraries). It compiles the Nim code in a few seconds and produces a final binary that's `810kB`. That's using MPack, JSON, RPC, Net, Sockets and other libraries with lots of sequences, strings, and tables all over and not optimizing so far at all. I was worried with C++ that 1.5mb might be tight... I also have about 170kB of free RAM after setting up 3 sockets, all the SPI's, JSON parsing. Multi-core / multi-threading has mostly just worked with the channel's and locks as well. It's been a joy. I'm curious how far one could push it with a GUI stuff... ;) There are a few pain points I've run into, like figuring out whether to use destructors vs finalizers to automatically free ESP-IDF resources. I've also run into a few more crashes than expected when I don't properly initialize some piece of memory when using ref's (though the stack traces with some `repr` printing have made it trivial to trace down). The only other oddity is nameless C unions with structs are a bit tricky (though workable). Next step: encryption/tls on the sockets? Eih. ESP-IDF uses mbed TLS, but not sure how that'll work with the `net` libraries.