Just came here to say that all blog posts about new releases of each and every product should start with the sentence which tells what the product is about. Helps those who click on HN link and have no clue what it's all about. Be more like Gleam.
> Gleam is a type safe and scalable language for the Erlang virtual machine, and today v0.15.0 has been released! Let’s take a look at some of the highlights.
The doc contains cheatsheets such as "Gleam for X users" where X is currently Erlang, Elixir, Rust and Python. I think this is a fantastic idea and could be adopted by other language communities!
Might I ask for some more guidelines on how to incrementally incorporate Gleam into existing projects in BEAM languages? A guide on interpolation with a phoenix codebase and toolchain would be wicked cool.
This is certainly something I want to have in future. Being able to add Gleam to an existing Elixir project is something a lot of people have asked for. It is possible today (Quinn did a great talk on this[1]) and there are libraries to help[2], but it's all a bit rough and ready currently.
The focus for now is on Gleam tooling, but once we have that down we can work more on Elixir tooling for Gleam.
> The doc contains cheatsheets such as "Gleam for X users" where X is currently Erlang, Elixir, Rust and Python. I think this is a fantastic idea and could be adopted by other language communities!
The Rust ndarray library as a "ndarray for numpy users" [0] which I thought was a very nice idea to help people from the python world convert their numpy code to Rust.
I agree, the cheatsheets are great. As a Python developer. the python sheet makes me file like I could dive write in and write a gleam program by having python in mind mind and looking up the gleam equivalent for each line of code.
But where it describes the map-dictionary duality, it says: "There is no map literal syntax in Gleam, and you cannot pattern match on a map. Maps are generally not used much in Gleam, custom types are more common."
But it doesn't say why or how this would be done. It seems that, if this point is going to be mentioned, there should be enough context to make it actionable.
@lpil - What's the status of OTP interop? Seamless integration of Gleam GenServers (for instance) into an Elixir/Erlang supervisor tree would be important for usage on most projects (particularly if you want to do incremental adoption).
The last thing I read was that the plan was to re-implement a GenServer alike from scratch in Gleam rather than anything built over the top of the existing GenServer implementation. I can see why that might be necessary but that's slightly concerning given how battle tested the existing GenServer implementation is and all the edge cases it handles.
It is not a wrapper around gen_server etc, but instead it is a full implementation from the ground up using a very small Erlang core (~200 lines). This was done because:
a) Erlang OTP cannot be typed, we need different abstractions are designed with types in mind
b) We want to be confident that our abstractions are powerful enough to build something like OTP, rather than cheating by relying on type casts.
I'm very happy with how Gleam OTP is going, but it is not the focus now that an initial version is out. Tooling and documentation is more important at the moment.
Shot in the wind, but is there a plan for different syntax? For those who've become comfortable in different fp camps, I can't really see myself picking up curly brackets and C-style code again. I really like the idea(s) of this project, but it's the thought of staring at that kind of code that's just a bit too much. I'd rather do something like [Nim,Scala,Clojure,F#]->JS if I needed to have that.
I've always kinda felt that there's a lost opportunity for extensible syntaxes by doing things this way rather than having the main surface of a language be some sort of intermediate representation (A la Wasm, LLVM IR, JVM, et al)
Congrats on the release regardless. It's good to see big stable projects in this niche in the BEAM-verse. The world needs more type safety.
Unlikely I'm afraid. We used to have an ML style syntax but once we switched to a more mainstream syntax we had a big surge in popularity and interest.
I am very fond of the ML syntax, but I think it is the semantics and type system that really matter, so I am very happy to sacrifice syntax in order to make Gleam more widely accessible.
You may prefer alpaca[1] which is in the ML family and on the BEAM. Someone could target Core Erlang [2] or BEAM byte code directly and offer a pluggable frontend for different syntax, Mix would almost allow that. I think it's just a huge lift to make happen and get everything to play nicely with BEAM semantics. But that's just like my opinion.
Ive been following this project for a while, it is extremely promising considering theres an interop between elixir and rust ecosystem. Lack of first-class typing and somewhat implicit resolutions/imports are my current annoyances with Elixir although its still my go-to until deno/ts tools mature. Some people mentioned already but dedicated docs for how to run phoenix/ecto with gleam, run any rust code with gleam would be super useful for understanding & adoption. Lastly rust-like “local” docs generation from types would be amazing, biggest thing missing currently in TypeScript in my view, existing tools are very premature.
Being able to build and view docs locally is a good idea, thank you. If you have some ideas as to what that workflow would be like it would be great if you could open an issue on GitHub
Is there any documentation on "Zero cost interop with Erlang, Elixir, etc" mentioned on the home page? I'd definitely be really interested if it can be integrated with eg. a Phoenix project.
If you're familiar with Elixir you can call Gleam functions the same way as Erlang functions. Gleam compiles to typical Erlang code, and you can even read the compiled output to get a better idea of how it works.
Later we will have more docs on how to work with Gleam from Elixir specifically, thank you.
In the other direction, to quickly discover how to call Gleam functions from Erlang/Elixir, one option is to explore your project with IEx's auto-complete functionality; it's the same as using Erlang functions in Elixir, as Gleam compiles to Erlang.
What is the "case" for Gleam? In general, and specifically for the choice of using the Erlang virtual machine?
I read the "Why Gleam" page, and it reads like "Why have static types" and "Why work on a virtual machine" + "Why we're as good as Erlang". That's not much of a pitch (especially if you're not already into Erlang.)
That's a good point, thank you. I am a long time Erlang/Elixir user and I've mostly been trying to attract that community in the past, so the docs are very biased towards already knowing the value of that ecosystem.
It's tricky to condense into a short reply, but the Erlang virtual machine and way of programming are in some respects second to none. It is build with scalability, concurrency, distributed computing, and fault tolerance in mind. It's really good at handling high load. It uses the actor model and it's not uncommon to have hundreds of thousands of actors in an Erlang programs (in fact the creator of Erlang says that's a "boring" scale) without any deadlocks or fiddly race conditions.
Erlang programs also have mechanisms for self healing when errors arise (bugs, hardware failure, whatever). Kind of like k8s style system but very fine grained and baked into the very language and with 35 years production usage.
This is a bit of an off-the-cuff fanboy-y ramble, but basically it's just a really nice ecosysem to work in when making networked services. I've personally found it makes things a lot easier than most other ecosystems I've worked in.
As mentioned elsewhere in the thread with more substance; Gleam runs on BEAM and uses curly brackets. I'm not into types, but I might consider it because I like curly brackets. I'm only partly joking.
Would love to see some highlights of differences between Gleam and Elixir as someone who has never used something Erlang based but has been wanting to try
It says that if you're a contributor, people can make anonymous complaints about you, and you will be judged and punished without being afforded the right to face your accuser and full access to the accusation and the evidence (that is, a "confidential" adjudication procedure).
Naturally, you can be punished for very vague offenses, under the title of any "conduct which could reasonably be considered inappropriate in a professional setting". It's not even any conduct which _is_ inappropriate in the setting of the project - it's enough that someone could subjectively consider it inappropriate, and in a different professional setting. In other words: Very easy to cook up charges as necessary.
If all of that is not enough - anyone who is deemed not to follow the code of conduct in good faith - i.e. it's not enough that you follow it, you have to show good faith about it - is an offender automatically. Even failing to actively _enforce_ the CoC is an offense.
Now, Gleam may not the only project with this kind of repressive project-criminal code; but this is quite saddening to see in a Free Software project.
I think you're reading too much into this. It doesn't say "you will be judged and punished". It says "All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances."
[+] [-] laacz|4 years ago|reply
> Gleam is a type safe and scalable language for the Erlang virtual machine, and today v0.15.0 has been released! Let’s take a look at some of the highlights.
[+] [-] sangupta|4 years ago|reply
[+] [-] natrys|4 years ago|reply
Might I ask for some more guidelines on how to incrementally incorporate Gleam into existing projects in BEAM languages? A guide on interpolation with a phoenix codebase and toolchain would be wicked cool.
[+] [-] lpil|4 years ago|reply
The focus for now is on Gleam tooling, but once we have that down we can work more on Elixir tooling for Gleam.
[1]: https://www.youtube.com/watch?v=UCIcJBM_YDw [2]: https://github.com/gleam-lang/plug/
[+] [-] nestorD|4 years ago|reply
The Rust ndarray library as a "ndarray for numpy users" [0] which I thought was a very nice idea to help people from the python world convert their numpy code to Rust.
[0]: https://docs.rs/ndarray/0.15.1/ndarray/doc/ndarray_for_numpy...
[+] [-] garyrob|4 years ago|reply
But where it describes the map-dictionary duality, it says: "There is no map literal syntax in Gleam, and you cannot pattern match on a map. Maps are generally not used much in Gleam, custom types are more common."
But it doesn't say why or how this would be done. It seems that, if this point is going to be mentioned, there should be enough context to make it actionable.
[+] [-] yewenjie|4 years ago|reply
Edit: In my experience almost all Rust tutorials are either for complete beginners or for developers with systems programming experience (like C/C++).
[+] [-] davydog187|4 years ago|reply
[+] [-] rkangel|4 years ago|reply
The last thing I read was that the plan was to re-implement a GenServer alike from scratch in Gleam rather than anything built over the top of the existing GenServer implementation. I can see why that might be necessary but that's slightly concerning given how battle tested the existing GenServer implementation is and all the edge cases it handles.
[+] [-] lpil|4 years ago|reply
https://github.com/gleam-lang/otp
It is not a wrapper around gen_server etc, but instead it is a full implementation from the ground up using a very small Erlang core (~200 lines). This was done because:
a) Erlang OTP cannot be typed, we need different abstractions are designed with types in mind
b) We want to be confident that our abstractions are powerful enough to build something like OTP, rather than cheating by relying on type casts.
I'm very happy with how Gleam OTP is going, but it is not the focus now that an initial version is out. Tooling and documentation is more important at the moment.
[+] [-] adenozine|4 years ago|reply
I've always kinda felt that there's a lost opportunity for extensible syntaxes by doing things this way rather than having the main surface of a language be some sort of intermediate representation (A la Wasm, LLVM IR, JVM, et al)
Congrats on the release regardless. It's good to see big stable projects in this niche in the BEAM-verse. The world needs more type safety.
[+] [-] lpil|4 years ago|reply
I am very fond of the ML syntax, but I think it is the semantics and type system that really matter, so I am very happy to sacrifice syntax in order to make Gleam more widely accessible.
[+] [-] ch4s3|4 years ago|reply
[1] https://github.com/alpaca-lang/alpaca [2] https://blog.erlang.org/core-erlang-by-example/
[+] [-] n42|4 years ago|reply
https://github.com/lunatic-solutions/lunatic
[+] [-] aravindet|4 years ago|reply
[+] [-] the_duke|4 years ago|reply
Haskell has "typed holes": https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_gu...
[+] [-] roebk|4 years ago|reply
Elm's compiler will prevent you from creating a production application with a `Debug.todo` still in place.
[+] [-] ModernMech|4 years ago|reply
[+] [-] brightball|4 years ago|reply
It's just a code comment, but by default Credo will exit non-zero if it sees one so if Credo is part of your CI pipeline it will fail it by default.
I'm one of those annoying people who puts # TODO comments all over my code though, so I set Credo so that TODO's wouldn't fail the build.
[+] [-] blandflakes|4 years ago|reply
[+] [-] _ZeD_|4 years ago|reply
[+] [-] ink404|4 years ago|reply
[+] [-] lalaithion|4 years ago|reply
[+] [-] izelnakri|4 years ago|reply
[+] [-] lpil|4 years ago|reply
[+] [-] djm_|4 years ago|reply
[+] [-] lpil|4 years ago|reply
[+] [-] crowdhailer|4 years ago|reply
[+] [-] dsiegel2275|4 years ago|reply
[+] [-] lpil|4 years ago|reply
[+] [-] mcintyre1994|4 years ago|reply
[+] [-] lpil|4 years ago|reply
Later we will have more docs on how to work with Gleam from Elixir specifically, thank you.
[+] [-] tynanbe|4 years ago|reply
In the other direction, to quickly discover how to call Gleam functions from Erlang/Elixir, one option is to explore your project with IEx's auto-complete functionality; it's the same as using Erlang functions in Elixir, as Gleam compiles to Erlang.
[+] [-] einpoklum|4 years ago|reply
I read the "Why Gleam" page, and it reads like "Why have static types" and "Why work on a virtual machine" + "Why we're as good as Erlang". That's not much of a pitch (especially if you're not already into Erlang.)
[+] [-] lpil|4 years ago|reply
It's tricky to condense into a short reply, but the Erlang virtual machine and way of programming are in some respects second to none. It is build with scalability, concurrency, distributed computing, and fault tolerance in mind. It's really good at handling high load. It uses the actor model and it's not uncommon to have hundreds of thousands of actors in an Erlang programs (in fact the creator of Erlang says that's a "boring" scale) without any deadlocks or fiddly race conditions.
Erlang programs also have mechanisms for self healing when errors arise (bugs, hardware failure, whatever). Kind of like k8s style system but very fine grained and baked into the very language and with 35 years production usage.
This is a bit of an off-the-cuff fanboy-y ramble, but basically it's just a really nice ecosysem to work in when making networked services. I've personally found it makes things a lot easier than most other ecosystems I've worked in.
[+] [-] toast0|4 years ago|reply
[+] [-] unknown|4 years ago|reply
[deleted]
[+] [-] sam0x17|4 years ago|reply
[+] [-] ricketycricket|4 years ago|reply
[+] [-] marton78|4 years ago|reply
[+] [-] marton78|4 years ago|reply
[+] [-] einpoklum|4 years ago|reply
https://github.com/gleam-lang/gleam/blob/main/CODE_OF_CONDUC...
It says that if you're a contributor, people can make anonymous complaints about you, and you will be judged and punished without being afforded the right to face your accuser and full access to the accusation and the evidence (that is, a "confidential" adjudication procedure).
Naturally, you can be punished for very vague offenses, under the title of any "conduct which could reasonably be considered inappropriate in a professional setting". It's not even any conduct which _is_ inappropriate in the setting of the project - it's enough that someone could subjectively consider it inappropriate, and in a different professional setting. In other words: Very easy to cook up charges as necessary.
If all of that is not enough - anyone who is deemed not to follow the code of conduct in good faith - i.e. it's not enough that you follow it, you have to show good faith about it - is an offender automatically. Even failing to actively _enforce_ the CoC is an offense.
Now, Gleam may not the only project with this kind of repressive project-criminal code; but this is quite saddening to see in a Free Software project.
[+] [-] lpil|4 years ago|reply
Rest assured that violations nor CoC trolling will not be tolerated in any way.
[+] [-] dsiegel2275|4 years ago|reply