Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would love to get into erlang and beam. As far as I know, Beam must be a great tool for servers and webservers in general. But can I use the language in other scenarios, too? For example commandline tools, desktop Gui's or games?


Command line can work, there's even escript for shorter tasks: "escript provides support for running short Erlang programs without having to compile them first, and an easy way to retrieve the command-line arguments."

GUIs are a challenge, I think there might be some change since this thread in 2017 [1], but the most supported way is wxWidgets and the interface is most unErlanglike. I gather it's similar to GUI programming in c++/mfc style which I never could understand. I do have an erlang program with a small gui (just a fixed sized bitmap output window, no controls, no inputs, no text other than titlebar), and I made it work with wx, but it felt a lot nicer with ex11.

ex11 is ancient, was an academic thesis project/proof of concept and is pretty much raw x11. Erlang and x11 work well together, Erlang is built for distributed systems and x11 is a distributed systems protocol. On the other hand, x11 doesn't include a widget library, the client has to bring one, ex11 has some widgets, but they're very basic. It also relies on x11 font rendering which is not very common anymore. If you wanted to build a mainstreamish GUI on ex11, you'd need to spend a lot of time on building a modern looking toolkit. (And make sure people have an X server)

Games are outside of my ability, but while it's certainly possible, I think the confines of immutable data and lack of shared state would tend to make things cumbersome. Screen output would also be a challenge. It might make netcode easier, though, because of the general need to do explicit communication may mean you're already thinking about how things interact and can avoid some of the pitfalls of synchronization.

[1] https://groups.google.com/g/erlang-programming/c/-0uH3DfnYvM...


Erlang/Elixir is great for internal command-line tools where a several-second startup time is acceptable. If you're looking to distribute the CLI tool externally, it's worth considering other languages.

BEAM would make a fine engine for GUI stuff but the toolkit bindings just don't exist. As another poster mentioned, LiveView + Electron could make a very compelling pair.

Erlang/BEAM has been used multiple times as a gaming network server language, but to my knowledge it has never been involved in the UI.


Commandline tools yes (though that's not it's strong point). Desktop GUIs could be done though I've not looked into it, if I were then I'd look at making a desktop Electron app and use something like Phoenix LiveView with that to create the GUI.

Games are a tricky one, it all depends on what you are doing with the game. I develop a middleware server for an RTS and for that it shines but it would not suit the gameplay side of things very well (you can of course still use it for anything!).

Repo for reference: https://github.com/beyond-all-reason/teiserver


Of course, if you're crazy enough you can shape almost any language for any purpose. I only mention this because I consider Elixir / Erlang one of the best examples of this, because Wings3D is written in Erlang. Who would use a language designed for concurrency and network reliability to write a GUI intensive 3D modelling program for desktops? It was what the author knew and he made it work!


Erlang includes erlang bindings for wxWidgets as used by observer and debugger. It is certainly possible to use them for making desktop GUIs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: