Warning
This is still, very, very, WIP. Some information is probably incorrect and there are many places that could use better wording.
Whenever or wherever you'd use BEAM or Javascript.
Gleam is a functional programing language.
Gleam does not have a REPL right now. It is a higly desired feature though so it will probably be added sometime in the future. If you'd like to work on this just ask what the status of this is.
Reference: #109
- Erlang (BEAM)
- Javascript (NodeJS/Bowser/Anywhere else JS runs)
Gleam->Erlang->Wasm
Gleam->Javascript->Wasm
Gleam->Wasm
- WIP - The person working on this is doing it as part of a school project, so not public at the moment.
- Use a JS engine to run Gleam compiled to JS (i.e. Tauri, AndriodX JavascriptEngine, Zipline, etc.)
- Use Erlang/OTP compiled for Android (Erlang OTP compiling guide, demo)
Gleam does not have it own runtime. It compiles to Erlang and Javascript which both have garbage collectors. Don't let having a garbage collector fool you into thinking it's slow though, Erlang (BEAM) powers giants like Discord and WhatsApp.
Gleam doesn't throw errors unless explicitly told to do so. So it just doesn't throw an error. There is also this article that goes into more details. Also see the Int and float docs.
See the Division By Zero
section.
No, this is probably never gonning happen. It's easier to bootstrap a language when it's still young and small, not when it hits 1.0
. And as Louis said:
"It would be many years of rework to get back to the same point and we’d have worse performance. Big waste of time as even if it went perfectly we’d just be back to where we were before minus whatever we would have gained from using those years on the existing compiler."
Gleamlins
. There's also Glemlins, Gleamers, and a few other ones, but we prefer Gleamlins.
Gleam has builtin FFI support for Javascript and Erlang. Any other languages have to be done through Javascript's or Erlang's FFI for your language. For example WASM for JS and NIFs for Erlang. There's also this blog post about Gleam's FFI.
No. Gleam is designed to be simple and this would defeat that. If you realy want this than look into some sort of templating.
Actually, they are. You're reallying just seeing shadowing in effect. The original value isn't mutated, it's just hidden by another defintion by the same name farther down. Shadowing only affects local scope and doesn't mutate the orignal value.
This blog post explores why Gleam only has data and functions, and not a multitude of data-structures.
Unfortunately InteliJ doesn't support LSP§
, the standard protocol for IDE tooling. Due to their unwillingness to implement the LSP protocol, IDE tooling maintainers either need a complex LSP to InteliJ translation layer or rewrite all their tooling for one single editor. Both options are terrible, so it's unlikely that Gleam will have offical support for InteliJ. There are however a few (old) community projects for InteliJ support.
§
- Basic support is in paid version but very basic and not in free version
Gleam is a functional programing language which don't have loops. In functional languages you just use recurrsion. Infinite recursion is also very efficent in functional languages. Details as to why can be found here.