Try Gleam

(nchagnet.eu)

55 points | by nchagnet 3 hours ago ago

82 comments

  • subarctic 2 hours ago

    I have a web app i've been using regularly and develop regularly with gleam on the frontend and backend. I have written very little of the code by hand and use claude to implement everything, open PRs and stuff and it works well. I like that it's typesafe and you can share code between the frontend and backend so easily, and you don't have to get a bunch of config right like you do if you want an all-typescript application. If I was writing it by hand I think I would find there's an annoying amount of boilerplate, but since ai is writing the code for me it's not a big deal.

    Overall, I recommend it.

    • doomspork 2 hours ago

      What framework did you use for Gleam? I feel the last time I looked that was one of the big absent libraries.

    • mono442 2 hours ago

      if the ai is writing everything wouldn't it be better to choose a more popular language?

      • lpil an hour ago

        Why's that?

  • nchagnet 3 hours ago

    I wrote this to show my appreciation of this small-ish but beautiful language.

  • adamddev1 3 hours ago

    Gleam is really a delightful language with great ideas, but the lack of currying is a tragedy.

    Missing currying feels a little to me like walking in FP land with one leg cut off.

    • kaoD 2 hours ago

      I never liked currying. It feels more theoretically elegant than practically useful.

      IMO it is hard to read (unless you're very familiar with the functions at hand), produces type errors that are not easy to follow (oops, I forgot the last arg), and is too rigid (I often need to partially apply arguments in non left-to-right order).

      I never understood why partial application via "slots" isn't more common though (I just made up the term, not sure if this has a name). Like Clojure's:

          #(f %2 "foo" %1 "bar")
          ;; same as
          (fn [a b] (f b "foo" a "bar"))
      
      Does Gleam have something like that?
    • stiiv 2 hours ago

      A deal breaker, and just when I was starting to get excited!

      Plenty of practical reasons for currying, but the biggest (imo) is for use with the pipe operator.

      If they don't have partial application now, what are the odds they'll have it in the future?

      • nchagnet an hour ago

        As I mentioned in my other comment, they do have partial application with _, and it works like a charm for piping! It's automatic currying which is absent.

  • hmokiguess 3 hours ago

    To your point on "Gleam: the bad" and the ecosystem being small, I would add that this community has a history of activism behaviour. Some like that, I'm out.

    • voidUpdate 2 hours ago

      What kind of activism? Isn't activism just "doing something to try and make a larger change"?

      • 15155 an hour ago

        Does "larger [political] change" need to run sidecar to a programming language?

    • nchagnet 2 hours ago

      I wasn't particularly aware of that to be honest. What kind?

      • hmokiguess 2 hours ago

        I saw a thread once from the language creator and community owner that left an impression on me https://news.ycombinator.com/item?id=46614727

        • jmcgough 2 hours ago

          Wait, people are upset because they have a code of conduct?

          • 15155 2 hours ago

            People are upset because their "code of conduct" extends far beyond the reasonable purview of the project.

            You may not participate if you hold and espouse ideals contrary to theirs in unrelated spaces.

            • jmcgough 2 hours ago

              Read the CoC again: https://github.com/gleam-lang/gleam/blob/main/CODE_OF_CONDUC...

              It doesn't police peoples' personal beliefs outside the community. It only says that while participating in the community you agree not to harass people and try to contribute in a positive way.

              I wonder if you have past experiences that are coloring your interpretation of this, because I'm really unsure where you're getting any of this from.

              • an hour ago
                [deleted]
              • surgical_fire an hour ago

                Eh, the controbutor covenant thing does have a tendency to attract people that are really into culture war and internet drama.

                That said, their CoC does not block anyone from merely using the language.

                • jmcgough 20 minutes ago

                  People working on an open-source language aren't 19-year-olds on twitter, you're using the wrong heuristic here. They're there mostly to talk programming and work on a project together. The CoC is pretty standard language that you'd find at most conferences you attend. It specifically enumerates bigoted actions because several contributors are members of the LGBT community. The last thing many of them want is to deal with culture war nonsense seeping into their fun hobby.

                  • surgical_fire 6 minutes ago

                    > The last thing many of them want is to deal with culture war nonsense seeping into their fun hobby.

                    This is bullshit.

                    Typically we are talking about the same category of people that become Reddit mods. Those are full blown adults where internet drama and culture war nonsense is their actual hobby. The open source thing beneath it is the side project.

                    It's the reason why I avoid getting involved with open source communities like billionaires avoid taxes.

                    That said, my original point is not to avoid Gleam as a language. The language itself looks pretty interesting. You don't need to stare at the CoC to use the language.

                • omnimus 20 minutes ago

                  I am honestly a bit confused because this whole comment chain looks like someone is starting culture war and drama? But you mean that the people who use gleam tend to be into culture wars, not the OP poster in the chain?

                  • surgical_fire 5 minutes ago

                    > But you mean that the people who use gleam tend to be into culture wars, not the OP poster in the chain?

                    Er... No?

                    I think I was clear that you can use the language without getting involved with the drama related to the community behind the codebase.

        • dsincl12 an hour ago

          [dead]

        • nchagnet 2 hours ago

          Sounds to me like a lot of divisive American politics, as usual.

          I have no problem with a community setting whatever acceptance criteria they like.

          If the license did the same, I could see a case of being a bit of overzealousness.

          I couldn't find if that was the issue, but if your problem is that the creator and the community have political opinions and don't like people with incompatible ones, then that's just society...

          • hmokiguess 2 hours ago

            > but if your problem is that the creator and the community have political opinions and don't like people with incompatible ones, then that's just society...

            No, I am fine with incompatible views and I often seek them in order to grow. I do not enjoy echo chambers and I usually prefer and welcome disparate, including contrarian, opinions.

            It's more like I don't want Ideology served with Programming Language, it feels like a distraction to me when I am in that mode. I usually consume Ideology under a different context, where I find it more productive and can contribute better to it.

            • nchagnet 2 hours ago

              I think you have a reasonable position here, so I understand where you come from.

              I find this whole thread here interesting because until today I wasn't confronted by any of this, even though I joined the Discord and had a pleasant time (and will keep doing).

              So I guess all I have to say on this is I don't think the "ideology" is that much served with the programming language. Yes I read that there's a code of conduct and that annoyed some people. But like I downloaded Gleam, I coded with it, I talked to people, and the thought police didn't knock on my door. So I guess what I mean is that it feels a little overblown.

              • hmokiguess an hour ago

                Thanks for understanding it, and yes not everyone draws the line at the same boundaries.

                Once in a while I try to push my boundaries, but then again I like to choose where I do this. For this one, I prefer not to do it in a work adjacent environment with strangers on the internet.

                That aside, the language sounds fun hope you create cool things with it!

              • 15155 2 hours ago

                > I don't think the "ideology" is that much served with the programming language

                Their ideology is literally on the front page of https://gleam.run/

                • AnimalMuppet an hour ago

                  On the front page or not, I think nchagnet's point is that, in practice, he doesn't bump into it much.

                  Whether that's good enough for you or not is up to you.

                • omnimus 18 minutes ago

                  you mean this?

                  > "As a community, we want to be friendly too. People from around the world, of all backgrounds, genders, and experience levels are welcome and respected equally. See our community code of conduct for more. Black lives matter. Trans rights are human rights. No nazi bullsh*t. "

          • 15155 2 hours ago

            > creator and the community have political opinions and don't like people with incompatible ones, then that's just society

            Why are my political views relevant? This is a programming language. Nobody is popping into the Gleam issue tracker and mentioning politics, nobody is violating the "code of conduct" there.

            The "code of conduct" exists solely to lambast people who disagree with the author's special interests in other irrelevant spaces. This is the "paradox of tolerance" in codified form.

            • nchagnet an hour ago

              I mean it's only relevant if you bring it with you in their community. You don't sign your soul away when you download the compiler. Do you have the same issue with all the ToS asking you to not be a nazi and whatnot on a given platform?

        • jakelazaroff 2 hours ago

          Where is the "activism behavior"? All I see in the thread is other people whining because they disagree with the Gleam community's values.

          • 15155 2 hours ago

            I am on that thread as well. The issue with these "codes of conduct" isn't that they exist, it's that their purveyors force the "code" upon every participant regardless of forum.

            If you don't support their special interests in completely unrelated venues, you are persona non grata and will either fall in line or be excommunicated. It's a sophisticated form of control via identity politics.

            • jmcgough 2 hours ago

              I think you're seriously overreacting; you don't need to believe the same things that they do, all the CoC states is that if you want to engage with the community, you agree not to harass people. Every community has similar expectations; having it in a markdown just makes it more explicit.

              • 15155 2 hours ago

                Sure, you don't need to "believe" the same things they do, but if you are vocal about your ideals on Twitter, for instance, you are unwelcome.

                "Don't publicly disagree with my ideals or I will use my little fiefdom to destroy you."

                • jmcgough 16 minutes ago

                  You might be letting your personal experiences pollute things. The CoC never says that. It's anti-harassment language, and specifically enumerates what that might look like. Some contributors are members of the LGBT community, and I'm sure don't want to debate their personal identity when they're there to contribute to a project and write code.

          • nchagnet 2 hours ago

            Couldn't find it either, and my experience with the gleam community is that they're very welcoming and positive people.

          • MoOmer 2 hours ago

            Agreed. Treat people well seemed to be the Gleam desire.

            The counterarguments from the other party (seemed like one person with multiple accounts to me) were about their disbelief in trans people and the idea behind the Black Lives Matter movement (coupling it with some organization that copied the name and stole some donations)

        • adamtulinius 2 hours ago

          Maybe you could be specific, instead of just spreading FUD? I read through the discussion you linked, and I have no idea what you’re talking about, so to me your comment comes of as just FUD.

    • OtomotO 2 hours ago

      > Some like that, I'm out.

      And a third group couldn't care less either way.

      I have a few decades on my back, I am a father, a husband, a nerd... I once was young too, believe it or not, and I had ideals and I fought for them.

      If you don't participate in this, why does it bother you? Unless they are active around your doorstep, that is.

      • hmokiguess 2 hours ago

        Fair point, I am with you on that. I guess just had a bad first impression on drama that I've seen as a spectator through the public channels that stuck.

        That could be repaired, just don't care enough to spend time there again I guess.

      • nchagnet 2 hours ago

        Couldn't agree more with this. Having ideals and principles isn't a bad thing, we all do.

      • bel8 2 hours ago

        I for one am thankful for their warning. Saved me precious time.

        Suggestions about cool projects are just as important as warnings about uncool projects.

        • OtomotO an hour ago

          Yes, it's just that I don't deem them uncool.

          Same as art by Hitler... if I would like it, I would like it, doesn't matter that I think he was one of the worst human beings.

          So: I just argued, that there is a third way to view it.

          You may, of course, see it completely differently and deem this project "uncool" for whatever reasons you want!

    • latinodev 2 hours ago

      opensource is activism

    • F3nd0 2 hours ago

      I don’t have a problem with activism per se, but it does put me off how the official website tries to make the language and community look extremely friendly and cutesy, only to immediately break that facade. If that’s the look you’ve decided to go for, at least try and commit to it!

    • surgical_fire an hour ago

      You know you don't need to follow hold their CoC in any way to use the language right?

      Do you only use languages that you can contribute to their codebase?

      • 15155 an hour ago

        "Contribute to their codebase" includes bug reports and seeking help with errata and other issues.

        It might be problematic to use a language where needed help could be preceded by Twitter or HN background and allegiance check.

        • surgical_fire a minute ago

          > "Contribute to their codebase" includes bug reports and seeking help with errata and other issues.

          That is exceedingly rare. The vast majority of times you will either find your answer online to work your way around issues.

          > It might be problematic to use a language where needed help could be preceded by Twitter or HN background and allegiance check.

          I would remind you that we have LLMs now. One of the greatest gifts of LLMs is not having to rely on talking to people online to figure out issues when using a language/framework/library.

  • stiiv 2 hours ago

    Apart from the language, what's the developer experience like, especially doing full-stack?

    F# showed a lot of promise with Fable, but the community never quite got the tooling right, I think for a lack of energy/funding.

    • nchagnet an hour ago

      I found the tooling to be quite comprehensive, the LSP is high-quality for a small project.

      There are a few rough patches too. For example, I have yet to find out how to run a single test and not the whole suite.

  • barddoo 2 hours ago

    I've been keen to try it out for a while, I might do something with it in the near future.

  • listedb 2 hours ago

    Hey! I know this!

  • micbas 3 hours ago

    Naive question: why do we care about programming languages when we no longer read programming languages directly? Shouldn't we either design languages optimized for LLMs? (needs fewer tokens, easier for bots to process, easier to machine verify, not sure what else)

    • profunctor 3 hours ago

      We do still read code. Most people are not doing a fully unseen development strategy because we have needs around efficiency, security, compliance etc and we can’t simply blame it on our agents like we don’t control them like OpenAI do

      • pjmlp 3 hours ago

        That is like arguing everyone should master Assembly when using high level languages. :)

        • profunctor 2 hours ago

          No it isn’t. I think you read into my comment too much.

        • wakamoleguy 2 hours ago

          Which tangentially brings up another analogy: many high level languages don’t compile directly to assembly but to an intermediate language first (LLVM). We don’t read the LLVM code ourselves.

          • rlander an hour ago

            But LLVM compilation is deterministic. LLM code gen isn’t.

            • pjmlp an hour ago

              Only when not used alongside PGO data or as a JIT, as its inputs are not deterministic in first place.

        • spider-mario 2 hours ago

          Who said “everyone”?

          • pjmlp 2 hours ago

            We do still read code. => We do still read Assembly code in the world of compilers.

            • spider-mario 2 hours ago

              Not seeing it. “We do still read code” implies neither that every single person does, nor that they need to master the language being read. Taken together, it seems to me that you need a fair bit of extrapolation (or a presupposition that programming languages are already obsolete when that’s the very point being contested) to make the analogy work.

            • Topfi 2 hours ago

              Deterministic vs None-Deterministic, understanding what compiled code does also is possible without Assembly knowledge, not so necessarily with models, where I do like to at least understand what has happened and quite often find a crime or five.

              Heck, OpenAI can't even get their models to reliably do what they intend, so yeah.

              • pjmlp 2 hours ago

                AOT without PGO, manual memory management, traditional optimisations vs AOT with PGO, JIT, tracing GC, machine learning optimisation passes.

                • Topfi 2 hours ago

                  Which have what to do with the relationship between assembly and the higher level language?

                  • pjmlp 2 hours ago

                    It is the answer to you Deterministic vs None-Deterministic.

                    If you don't get the difference, I get there isn't much that you know about how instruction selection works, across all those approaches.

                    • Topfi 2 hours ago

                      Ok, I feel you know what this is actually about, but here spelled out:

                      Do any of the optimizations you mentioned affect the underlying behavior of the run code? Semantics...

                      If not, it doesn't fit to LLM use, where this is very much the case. We can talk about bugs in compilers and undefined behaviours and so on and so forth all the livelong day, but you know as well as I that this is not of the same scope of impact.

                      I could and in the past would have written a long diatribe about how pure compilation to assembly is deterministic, thus making this not really suitable and that while yes, there are things like JVM that aren't 100%, we have contracts, docs, specs and, because of them, an expectation of consistency that LLMs do not deliver. I did not because I thought that was not necessary, but see my error now, that is my mistake.

                      • pjmlp an hour ago

                        There is the observable behaviour, and the machine code instructions that actually get generated in every single case for the same kind of text input.

                        Which for example, unless you can exactly replicate the world every single time a PGO data gathering session is done, there are no guarantees that the compiler will generate exactly the same machine code pattern, when given various PGO files generated at different occurrences.

    • Gualdrapo 3 hours ago
    • wakamoleguy 3 hours ago

      We might still read them, but let’s set that aside. Some languages may offer ways to eliminate entire classes of bugs. Gleam and Haskell-ish languages do that through very strong type systems and expressive high-level functional constructs. Rust similarly eliminates a ton of memory errors through its borrow checker. LLMs aren’t infallible, so this can result in better quality code (or if you believe every bug will still be caught…less code to do it).

      Gleam also runs on BEAM, which has important runtime characteristics vs other languages. That will impact your system and how it scales even if you never look at the code.

    • logophobia 3 hours ago

      I mean, even if you've stopped even reading code (good luck with that), the right abstraction should make things things easier for the LLM. A good rich type system to stop incorrect code, linters to catch common errors. A good set of battery-included system libraries. BEAM should provide a good abstraction for highly parallel and distributed systems, which means the LLM doesn't need to build all those abstractions itself. If you're building a distributed system, it should be like providing a set of good guardrails, guiding the LLM in building a correct system.

      I've seen even the best models try to build & debug parallel and distributed systems. The results are always a bit uneven at best, even with a good harness and a lot of guidance.

      The disadvantage of niche languages is that the LLM won't quite know the language as well due to less training data being available. But if you actually need to build something distributed, then this might be a good trade-off.

    • WJW 3 hours ago

      Who's this "we" you speak about. There is a small subset of programmers who have become effectively become managers and ask their AI employees to do things. The rest of us still regularly read and write code.

    • nchagnet 2 hours ago

      Even in an AI intensive workflow, reading code remains a huge quality gate and I'd be wary of any software which hasn't been reviewed by humans.

      Moreover, to me coding carefully is still a hobby, a pleasure, a craft. Gleam is exactly the kind of language that makes this such a pleasant activity.

    • benrutter 2 hours ago

      I'd make two cases:

      1. In a lot of cases, even if you're pure vibecoding and not reviewing any code, its still useful to be able to read it - you can then verify and reason about various aspects. LLMs are often flat out wrong on niche issues of performance etc, so for cases like this, not being able to read code is a big risk.

      2. "Languages optimized for LLMs" sounds awesome, but so far, to me at least, it seems like LLMs work best in the same situations as humans- good test coverage, low-complexity, clean architecture, etc.

    • Topfi 3 hours ago

      For what it's worth, I still parse code changes and feel uncomfortable if I struggle to understand code output without assistance.

      On the "languages for LLMs front", isn't that a bit "cart-before-horse"? Doubt we are anywhere near the limit of what a model could do with a static verifiable language, even more so since stuff like TS has massive training data, any new language wouldn't benefit in such a way.

      Add to that, I'd rather be able to understand the output, partly for aforementioned reasons, partly because we have seen with post Spud GPT reasoning/summarisation issues what happens when being able to read model output becomes even slightly harder. Having model-focused languages would only exacerbate such issues.

      Also, absolutely not a Maths expert so take this for an utter layman regurgitating of what I have read, but apparently the Lean proofs by OpenAI are very hard to parse even for the experts in the field, lovingly called "Clanker Proofs", even when they are valid.

      Having not just correctness but also human understanding as a goal has merit, so there is that to consider too. Rather models get more efficient at using what we have (and can understand+maintain as humans if need be) then make it more opaque.

    • OtomotO 2 hours ago

      > why do we care about programming languages when we no longer read programming languages directly?

      Because, we do?

      You may not, which is fine. A lot of developers may not... that's fine. I guess you're all employed and don't risk your livelihood when things go wrong.

      I do though. I take responsibility.

      And just like with any junior developer I guide AI and I do review what it creates in the project that matter. (Personal tools I've entirely vibe-coded, never any client projects though)