5 ms·
My first impressions of Gleam
- asib 1y ago> [...] It’s an Elixir-like language that supports static typing. Maybe just me, but when I tried Gleam it really came off much more like Rust. In fact, other than running on the BEAM (and having some OTP libs in the works), it doesn't really _feel_ like Elixir at all to me, but that is definitely an opinion.
- tengbretson 1y agoI've kind of gotten a Scala : Gleam :: JavaScript : Lua vibe from it.
- jszymborski 1y agoIt also most reminded me of Scala.
- sodapopcan 1y agoThey probably just mean "BEAM language that isn't Erlang." All BEAM languages always bring something new to the table aside from just syntax (for Gleam it's static type, for Elixir it's macros and, well, mix!) but none of them try and abstract away the core tenants of the BEAM being functional working with modules and processes. So ya, in that sense you could say it's like Elixir.
- sbrother 1y agoHow good is the interop story with Elixir/Erlang currently? Can I include a few gleam modules in my Elixir application and let mix take care of compiling and linking everything properly?
- sethhochberg 1y agoI'm currently working on a prototype that does exactly this (in our case, the Gleam is essentially a typed calculation module wrapped in Elixir's great libraries for network and database interactions but its all net-new application instead of an existing Elixir codebase). Its not yet perfect, but I've been eagerly following along with this PR: https://github.com/elixir-lang/elixir/pull/14262#issuecomment-2753641371 https://github.com/elixir-lang/elixir/pull/14262#issuecommen... Seems like (one of) the next Elixir releases will include the support you're looking for in mix.
- felixyz 1y agoThis is going to be very good for Gleam IMO. Having a super-easy on-ramp for using Gleam in Elixir projects will let people experiment with implementing eg more complex business logic in Gleam, and allow gradual adoption. Naturally, this is not the focus of the Gleam project itself, but for me, using Gleam for the core of a project while having access to the amazing Elixir ecosystem is a dream come true. I've been using mix_gleam but it's not perfect and since I started using Gleam pre 1.0, and it's a low-velocity project, updating became too complicated and I actually ended up moving everything to Elixir recently.
- datboi_420 1y agoThis was a great read! One thing that def makes Gleams error handling _look_ nicer, is utilizing `result.try` with the `use` keyword.
- back2dafucha 1y agoThe only languages Im interested in are future proof AI resistant languages. Since LLMs need alot of training (because they cant read language ASTs and write code correctly), a language that either isnt possible to express using fonts and character sets on the Internet, can only live in a private cloud, and is known to only verified practitioners runs on everything, and yet cant be decompiled. You can launch a nuclear war in 5 lines of Visual Basic. I want a language AI doesnt know and cannot ever know.
- DetroitThrow 1y ago>and cannot ever know It might be resistant to human uptake in that case, too? Brett Victor I suppose has some interesting human-first or human-only physical computers.
- back2dafucha 1y agoThats ok. We have done enough language research to build another powerhouse language that is AI resistant that practitioners can use. Its uptake is only relevant to those that wish to exclude LLMs from the picture to resist the agents. When LLM agents are everywhere secret societies will become the norm. We may even have the expertise to actually transpile every single program into a unique programming language so that if the source were available LLM bots would not recognize it in any volume enough to learn from it.
- jcmontx 1y agoYou better start writing your own compilers then
- MomsAVoxell 1y agoThis, however, has always been true and is not just an issue of AI.
- flexagoon 1y agohttps://en.wikipedia.org/wiki/Malbolge https://en.wikipedia.org/wiki/Malbolge
- IncreasePosts 1y agoI'm glad I'm not the only one who hoarded all their AIM log data. Whenever I want to cringe I can pull up a random file
- lordofgibbons 1y agoGleam has caught my eye for the past year or so, and I'd totally learn it if I didn't believe firmly that we won't be coding by hand within the next 9 months. It'll all be done by LLMs so syntax and ergonomics won't mean too much. At least as soon as LLMs learn to stop being turbo-slop generators.
- 0x3f 1y agoYou should learn Gleam then.
- buggy6257 1y agoSee you in 9 months then to check back.
- tgv 1y agoAnthropic's CEO said 6 months, 6 months ago. https://futurism.com/six-months-anthropic-coding https://futurism.com/six-months-anthropic-coding
- echelon 1y ago> if I didn't believe firmly that we won't be coding by hand within the next 9 months. LLM-assisted coding is awesome, but it feels like a self-driving style problem. It's going to take 20 years to get there.
- a3w 1y agoDoe LLMs write valid Gleam programs? Trying with ChatGPT three years ago, it did not. Workarounds, like "here is the syntax as a system prompt", put into the prompt I would not consider understanding, as Gleam idioms and patterns will certainly not all fit.
- perrygeo 1y agoThe entire Gleam language tour (https://tour.gleam.run/everything/ https://tour.gleam.run/everything/) is comprehensive. It contains examples of every language feature and prints to less than 70 pages - easily fits into the context window of any recent LLM.
- munchler 1y ago> I’ve also heard that functional languages lend themselves especially well to parsing tasks, and I’ve never understood why, so it’s a good opportunity to learn. This is mainly due to a technique called "parser combinators", which can be expressed very cleanly in functional languages. The idea is to start with a standard set of primitive general-purpose parsers and combine them into more complex parsers that are specific to the task at hand. If you have an interest in either functional programming or parsing in general, parser combinators are good to have in your toolkit. It looks like Gleam has at least two parser combinator packages that you might be able to use: • party (https://hexdocs.pm/party/) • parser_gleam (https://hexdocs.pm/parser_gleam/)
- asplake 1y agoOr thanks to algebraic data types and pattern matching? Even in a modest recursive descent parser, these can be really nice to use.
- munchler 1y agoSure, although those are great FP features for all kinds of programming, not just parsing.
- IshKebab 1y agoI don't think parser combinators are any more difficult in imperative languages like Python than functional ones? I found a few for Python and C++.
- andai 1y agoAll Turing-complete languages are technically equivalent in capability, but that doesn't mean the same task will cost the same effort in each language. The closer a task is to the limit of your ability to handle complexity, the more you will benefit from tools that simplify the task. The choice of programming language unfortunately what tools are possible to implement ergonomically (in terms of both implementation and interface).
- 1y ago
- jszymborski 1y agoGleam has long kinda seemed like my idea programming language. My only real hang-up is maybe an irrational one, but I don't love that it needs either a VM (BEAM) to run, or for it to be compiled to an interpreted language (javascript). I really wish it could target LLVM or something so it could be compiled down to native. Maybe someone can sell me on BEAM though. EDIT: The comments below are indeed beginning to sell me on BEAM, I'm realizing my reluctance might come from some negative experiences I've had dealing with the JVM.
- gmassman 1y agoThe BEAM is an amazing piece of technology. It’s built to scale massive concurrent systems and has great developer ergonomics. I’ve used it with Elixir and it’s really a breath of fresh air as far as running a webserver goes. Much more flexible and simpler to manage than a python or nodejs runtime, and also capable of scaling up with far fewer resources than you would think. Highly recommend giving it a go!
- brightball 1y agoThe BEAM is very lightweight and necessary within Erlang to enforce one of its greatest tradeoffs: - No universal garbage collector, every process (aka green thread) has its own heap that is reclaimed when it dies. - No process can takeover the CPU. If you run a hugely intensive task in one process, everything else, millions of other processes potentially, will continue responding normally and consistently. The hugely intensive task will just take longer. There’s more that applies to some advanced use cases, but these are the 2 core elements that are awesome.
- Cyph0n 1y agoI have never seriously used a BEAM language (Elixir/Erlang/Gleam), but for me, it’s the opposite: the most attractive part of Gleam is that it runs on BEAM :) My reservations at this point are mostly around maturity of the language, the stdlib, and the library ecosystem; although I haven’t been following progress too closely.
- worthless-trash 1y ago
- brightball 1y agoThere was a great talk on Gleam at the Carolina Code Conference in 2024. https://youtu.be/vyEWc0-kbkw?si=3o-KasK4H2n-0_KD https://youtu.be/vyEWc0-kbkw?si=3o-KasK4H2n-0_KD
- thayne 1y agoMy biggest problem with gleam is the lack of any kind of ad-hoc polymorphism (interface, trait, typeclass, protocol, etc.). It also seems weird to make a language for BEAM that depends on a separate library for actors and concurrency.
- Nezteb 1y agoI thought so too, although treating everything as data and functions is really nice [1]. Regarding the BEAM and why Gleam has a separate library for actors: [2] > "One notable difference between Elixir and Gleam is that Elixir gets to just re-use the OTP code as-is (with some Elixir wrappers on top for convenience). Gleam concluded that the OTP is built expecting dynamic types, and that for best results in Gleam they'd need to re-implement the key primitives. That's why the example shown is an "Actor" not a GenServer - it serves the same purpose, and might even fit in a Supervision tree, but isn't actually a GenServer." There's a brief snippet mentioning this in the Gleam OTP readme as well: [3] > "Actors do not yet support all OTP system messages, so some of the OTP debugging APIs may not be fully functional." [1] https://mckayla.blog/posts/all-you-need-is-data-and-functions.html https://mckayla.blog/posts/all-you-need-is-data-and-function... [2] https://news.ycombinator.com/item?id=40645489 https://news.ycombinator.com/item?id=40645489 [3] https://github.com/gleam-lang/otp#limitations-and-known-issues https://github.com/gleam-lang/otp#limitations-and-known-issu...
- deleted 1y ago[deleted]
- curtisszmania 1y ago[dead]
- WJW 1y agoIt really is a neat language. Sort of like the smaller more elegant language that has been waiting to break out of Haskell, but combined with Erlang. Definitely not the "standard" programming language but very very nice. The core language is pretty small too. Any moderately experienced programmer can probably burn through the language tour and be ready for a few simple AoC problems in an afternoon or so. This is due to the language designer having a very strict dedication to keeping the language as simple as possible. (Much to the chagrin of my muscle memory, as I keep expecting pattern matching on function arguments to work but it doesn't)
- scuff3d 1y agoI tried with Gleam, I really wanted to like it. I really like Louis Pilfold and I like his goals for the language. But something about it just didn't click for me. It's a good language, but at the end of the day I just didn't enjoy writing it. It might be something the author talked about, but I think the language might be too small. It's one of the things I dislike about Rust too. I prefer a more batteries included approach because I can't stand having to pull in a bunch of small dependencies.
- jitl 1y agoRust is a HUGE language with a small stdlib. Gleam is a small language with a small stdlib.
- scuff3d 1y agoYes, thank you for pointing that out... My point was about the need to rely on external libraries. I'm not a fan of that approach. I don't care for it in Rust or JavaScript, and I get a similar vibe from Gleam.
- jitl 1y agoAgree. My dream: Go stdlib and tooling + A good programming language
- oDot 1y agoI moved to Gleam with all of my projects and am not going back. The language is fantastic but really the most impactful are the coding paradigms that it enables, especially the actor model and especially on the front end (The Elm Architecture)
- sureglymop 1y agoSo do you build stuff using Wisp and Lustre? I would love to look at some example applications!
- oDot 1y agoYes. https://nestful.app https://nestful.app used to be TS + Vue but it's almost entirely Gleam now, with Lustre used for state management and only the views being Vue templates. Those will also be migrated away for a fully Lustre solution. Blog posts: https://blog.nestful.app/s/the-tech-behind-nestful https://blog.nestful.app/s/the-tech-behind-nestful
- librasteve 1y agothanks for posting this --- very interesting to read the "first impressions of FP" side of it to be honest, I felt like shouting "please try raku" (https://raku.org https://raku.org) after about 4 paragraphs! why? well raku Grammars are built in parsers...
- justusthane 1y agoAs someone who isn’t a programmer, but enjoys dabbling, and has been curious about functional languages, this was a really helpful (and fun!) read! Tutorials written by beginners are so valuable, because once you’re more experienced with a given subject, it’s hard to remember what it was like to be a beginner. It can feel vulnerable to write them because you have to expose your ignorance, but it’s such a great thing to do.
- effnorwood 1y ago[dead]
- figbert 1y agoI was tricked into trying Gleam earlier this summer, and really liked it! I anticipate that I will at least use it for all future web projects (one example: https://github.com/FIGBERT/bdab https://github.com/FIGBERT/bdab) due to my serious JavaScript allergy. I will note something that might be of use for the work in this particular article: https://hexdocs.pm/gleam_stdlib/gleam/dynamic/decode.html https://hexdocs.pm/gleam_stdlib/gleam/dynamic/decode.html Gleam Decoders are something I haven’t fully wrapped my head around, but are supposedly very powerful and do exactly what this article is focused on (parsing input data into Gleam types) in a more(?) idiomatic way.