11 ms·
Gleam 0.15
- djm_ 5y agoA solid set of changes and incredibly well presented for digesting what changed and why - congrats on the release!
- lpil 5y agoThank you!
- crowdhailer 5y agoPleased to see this release, looking forward to getting JS compilation soon too. Exciting times.
- lpil 5y agoAye, I am very much looking forward to that feature
- dsiegel2275 5y agoI wasn't tracking that JS compilation was an intended feature. Is there any documentation regarding a plan / expected timeline for that?
- lpil 5y agoNothing has been officially announced but it is something that is being worked on. There is a milestone for it on GitHub https://github.com/gleam-lang/gleam/milestone/17 https://github.com/gleam-lang/gleam/milestone/17 I expected we'll have an initial offering within the next half year.
- dsiegel2275 5y agoThat is amazing. Thank you!
- ergl 5y agoCurious, how are you planning to translate processes to the browser?
- lpil 5y agoWe likely will not attempt to port the Erlang concurrency model to the browser, at least not to start. Some Gleam users have been experimenting with an actor model library in JavaScript, this could be the basis of future research. More generally, Gleam doesn't have any concurrency primatives in the core language currently. We have a type safe OTP library, but it implemented in userland with a core of ~200 lines of Erlang rather than being built in to the compiler.
- davydog187 5y agoIf you like the direction Gleam is heading, you should really support Louis! https://github.com/sponsors/lpil https://github.com/sponsors/lpil
- adenozine 5y agoShot 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.
- lpil 5y agoUnlikely 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.
- G4BB3R 5y agoIs it possible that the popularity increase albeit being correlated to the syntax changes, was not caused by it?
- rkangel 5y agoIt is possible, but would be an interesting co-incidence. More anecdotal evidence, but Elixir has an easier time with adoption that Erlang and a big part of that reason is syntax. It's superficial, you get past it quickly, but it's the first thing you encounter and that can affect whether people give a language a 'proper' go.
- lpil 5y agoThere certainly were other factors, but people have been quite vocal in their enjoyment of the new syntax. I think the ML people like me are kinda used to not getting their favourite syntax. Alas!
- deleted 5y ago[deleted]
- natrys 5y agoThe 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.
- lpil 5y agoThis 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. [1]: https://www.youtube.com/watch?v=UCIcJBM_YDw https://www.youtube.com/watch?v=UCIcJBM_YDw [2]: https://github.com/gleam-lang/plug/ https://github.com/gleam-lang/plug/
- nestorD 5y ago> 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. [0]: https://docs.rs/ndarray/0.15.1/ndarray/doc/ndarray_for_numpy_users/index.html https://docs.rs/ndarray/0.15.1/ndarray/doc/ndarray_for_numpy...
- yewenjie 5y agoIs there a good Rust for Python developers tutorial anywhere? Edit: In my experience almost all Rust tutorials are either for complete beginners or for developers with systems programming experience (like C/C++).
- lpil 5y agoThere's not really any tutorials yet I'm afraid. I'm working on it though!
- aravindet 5y agoThe todo keyword https://gleam.run/book/tour/todo.html https://gleam.run/book/tour/todo.html is brilliant. Are there any other languages that have this?
- ModernMech 5y agoProbably based a little on this: https://doc.rust-lang.org/std/macro.todo.html https://doc.rust-lang.org/std/macro.todo.html
- _ZeD_ 5y agoit's not the same, but it's almost idiomatic to leave unfinished python code with "..." (the ellipsis object) def foo(bar, baz): ... is a valid (empty) python function
- senkora 5y agoOh, interesting. I’ve always used “pass” for this.
- staticassertion 5y agoYeah, but this is best used for abstract methods or type stubs. I think in 'real code' you would want to raise NotImplementedError, or even (if you use mypy) potentially return a NoReturn ie: from typing import Any, NoReturn def foo(bar: Any, baz: Any) -> NoReturn: raise NotImplementedError
- toast0 5y agoPerl has ellipsis which will die on use.
- roebk 5y agoElm has `Debug.todo`. If you were to use this, it allows your app to compile in development but the app would crash should it hit this code. Elm's compiler will prevent you from creating a production application with a `Debug.todo` still in place.
- ink404 5y ago
- rkangel 5y ago@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.
- lpil 5y agoWe have a fully type safe and Erlang compatible OTP library! It is used in production today. https://github.com/gleam-lang/otp 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.
- einpoklum 5y agoWhat 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.)
- lpil 5y agoThat'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.
- einpoklum 5y agoOk, so... 1. I'm not much of a VM person, but I'm always doubtful of claims by VM-based languages to be "fast". 2. "the ... virtual machine and way of programming are in some respects second to none" - We don't easily notice any of those respects on the "Why Gleam" page. 3. "It is built with scalability, concurrency, distributed computing, and fault tolerance in mind" <- That's rather vague. Also, is this a benefit of Gleam, Erlang, or the Erlang VM? 4. "It uses the actor model" <- Many, perhaps most, languages, don't "use the actor model", so I wouldn't know why this it is superior to other ways of programming. 5. "it's not uncommon to have hundreds of thousands of actors in an Erlang programs" <- Well, I didn't see actors in the examples, so I can't tell why this is impressive. 6. If Erlang is so nice, what's wrong with it to make me prefer an non-Erlang, but Erlang-sih language? 7. "Erlang programs also have mechanisms for self healing when errors arise" <- In the most general interpretation, this is Turing-complete, so such a feature is impossible. But perhaps you mean something like exceptions and error codes? Transactional data structures? Something else? I'm not trying to be facetious, just to understand why this is interesting. Also see my comment about the project CoC, it's pretty scary.
- mcintyre1994 5y agoIs 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.
- tynanbe 5y agoYou might be looking for https://gleam.run/book/tour/external-functions.html https://gleam.run/book/tour/external-functions.html 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.
- lpil 5y agoIf 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.
- izelnakri 5y agoIve 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.
- lpil 5y agoBeing 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
- einpoklum 5y agoPlease take a moment to read the project's Code of Conduct: https://github.com/gleam-lang/gleam/blob/main/CODE_OF_CONDUCT.md 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 5y agoAny code of conduct violation or accusation will be taken with the greatest level of seriousness and will be investigated by myself. Rest assured that violations nor CoC trolling will not be tolerated in any way.
- einpoklum 5y agoYou're saying that the failings of the formal procedures will be made up for by the benevolence of the person exercising investigatory and judicial powers. Perhaps the way the project actually runs is fine - after all, I don't know you nor the project. But generally, that's not the case. When I consider collaborating/contributing significantly to a project, and I see something like this CoC, it is a large red warning light. (Which is a bit ironic considering it's supposed to enforce inclusiveness and a welcoming atmosphere...)
- 5y ago
- laacz 5y agoJust 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.
- sangupta 5y agoI love this idea. Will keep in mind the next time I happen to draft the release notes.
- sam0x17 5y agoWould 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
- marton78 5y agoGleam is typed, for starters.
- marton78 5y agoGleam is type safe, for starters.
- ricketycricket 5y agoSyntax-wise, this is a pretty great comparison: https://gleam.run/cheatsheets/gleam-for-elixir-users/ https://gleam.run/cheatsheets/gleam-for-elixir-users/