My Impressions of Gleam

snarky.ca

30 points

ingve

a day ago


80 comments

dartos a day ago

The article is fine, but I have one serious concern.

How on earth do you prefer tabs to curly brackets?!?!

  • sheepscreek a day ago

    Readability? It is crucial for indicating which code belongs to specific blocks to help the compiler/interpreter and humans alike. There are primarily two methods for structuring code to achieve this: rigid indentation rules, as seen in Python, or the use of brackets. Elixir and Ruby use end blocks, which essentially serve as a substitute for curly braces.

    Similarly, when considering JSON versus YAML or TOML for human readability, the same principles apply. Personally, I find indented code more readable, but this can be easily attained in most languages with universal code formatting rules and intelligent code editors that highlight different elements to improve readability.

    • dartos a day ago

      It’s crazy that we have totally opposite views here.

      I find code block which are delineated by brackets so much more readable than ones delineated by invisible characters. Especially at a glance

      I don’t love do..end either, but still prefer them to arguing with Python about the level of indenting not being correct or that spaces were used somewhere somehow.

      > this can be easily attained in most languages with universal code formatting rules and intelligent code editors that highlight different elements to improve readability.

      Ofc, none of this is a practical issue, but that’s what makes it a fun topic of discussion ;)

    • gumperbumper a day ago

      My biggest issue with tabs over curly braces is that it makes copy / pasting code insanely difficult. That alone makes tabs a bad choice.

    • lolinder a day ago

      Why not both? Approximately no one uses braces without indentation, and that's trivially enforceable with a code formatter. But I personally find that the redundant signal of the braces makes things much more readable than in the languages that lack that redundancy!

      Every human communication mechanism includes deliberate redundancy to ensure that the meaning gets through even in suboptimal situations. Programming languages are somewhat unique in having a strong movement towards eliminating all redundancy.

  • sodapopcan a day ago

    Gotta love that this comment has the most replies :D

    I don't understand how people prefer curly braces, a character that is almost always has other meanings within the same language, instead of something like `end`. To that (ahem) end I don't understand how people prefer `end` to the exceptionally clear `endif`. Turns out different people have different preferences :D

    • dartos a day ago

      It’s always a fun little, largely meaningless, bike shed. ;)

      I don’t understand how people prefer invisible characters which change sized depending on the editor to visible ones which are consistent and easy to scan for.

      • sodapopcan a day ago

        Oh boy there is a whoooooole fun thing on that here: https://github.com/prettier/prettier/issues/7475

        And ya I also don't appreciate having to care about formatting for my code to compile and not being able to put debug statements at column 1 so they stick out like a sore thumb, though I suppose the solution to the latter is to stop being a puts/print debugger but, like... no :)

  • fire_lake a day ago

    It’s quicker to move code around with whitespace because you can just tab it in and out, move lines etc.

    The best solution is to ban tabs entirely from the syntax - only allow spaces in multiples of 2.

    • dartos a day ago

      I can’t agree with that.

      Curly bracket blocks are obviously visible at a glance. If I incorrectly move one around it’s obvious.

      If I shift tab a section of python code around, I may be breaking an if state without noticing if I didn’t pay attention to a specific colon on one line.

      Imo s-expressions are the easiest to move around, but have the same issue of being hard to scan as tabs.

      • fire_lake a day ago

        Whitespace works better in the context of statically typed functional programming, I’ll give you that!

    • lylejantzi3rd a day ago

      It's easier and quicker to move code around with braces when you're using vim. Vim has motions for selecting, editing, copying, etc everything between two braces. Without the braces, it makes moving that code around much more difficult, and error prone.

      • lawn a day ago

        Although I agree in general you can configure capture and move to be whitespace sensitive, for example by relying on tree-sitter.

  • AsthmaBoy a day ago

    I like to structure my code as an outline.

    Helps readability, quick visual hint of structure and i don't have to keep track of open-end brackets.

    Though i much prefer spaces to tabs.

  • troupo a day ago

    > How on earth do you prefer tabs to curly brackets?!?!

    In general, how is significant whitespace both a thing, and popular?

    • agumonkey a day ago

      i don't mind as long as it's simple and regular (python is ok for instance)

      • dartos a day ago
        5 more

        Personally, I think using invisible, editor dependent characters is neither simple nor regular.

        • agumonkey a day ago
          4 more

          i kinda agree but in practice it stopped being an issue 25 years ago

          • troupo a day ago
            2 more

            It didn't stop being an issue 25 years ago.

            Python of course still has invisible issues like silent invalid identations in `if` clauses, for example. Well, you could fix those with copious amounts of tests, of course.

            Same goes for YAML where invalid identation can will still be easily valid YAML.

            • agumonkey a day ago

              the honest amount of time I had syntactic issues with python in 10 years was 1.5 (my emacs removes whitespace between methods which made an admin unable to binpaste it directly on a remote machine)

              never once did we (and I have some bad apples at work) hit a problematic indentation in conditionals or other structs

              i'm honestly surprised

          • dartos a day ago

            Yeah we’re just bike shedding here ;)

  • worthless-trash a day ago

    This same discussion was had a long time ago when python was being more commonly used. I figure people just get used to it, and now we're in the inverse.

    • arrowsmith a day ago

      "Get used to it" doesn't mean "like it" or "prefer it".

      I've gotten used to a lot of things that I'd rather not have to deal with.

    • more-nitor a day ago

      > people just get used to it

      it's not just a matter of preference -- "no-curly-brace" dogma means it's impossible to do multiline lambdas in python

      • worthless-trash 16 hours ago

        This doesn't seemed to have affected pythons growth and popularity.

    • dartos a day ago

      Isn’t python currently the most popular programming language?

      • fire_lake a day ago
        7 more

        JavaScript (and variants) is

        • frabcus a day ago
          3 more

          Python is slightly above it on the StackOverflow 2024 developer survey.

          https://survey.stackoverflow.co/2024/technology#2-programmin...

          • coder543 a day ago

            The "admired and desired" chart has nothing to do with actual use.

            According to this chart[0] higher on the same survey report, JavaScript is the #1 most used, and Python is #3.

            But, I don't see this as a contest... being "the most popular" programming language doesn't automatically make it the best choice for a given task.

            [0]: https://survey.stackoverflow.co/2024/technology#most-popular...

        • dartos a day ago
          3 more

          While not the be all end all, TIOBE disagrees.

          https://www.tiobe.com/tiobe-index/

          I think since the AI boom, Python took over.

          • kibwen a day ago
            2 more

            I'm not here to take a stance on Python vs Javascript, but I am here to remind people that TIOBE is utter nonsense with no informational value whatsoever. Please stop linking it.

            • dartos a day ago

              It has exactly as much value as discussing whether Python or JavaScript is more popular.

              Which is to say, very little.

vegabook a day ago

It doesn't have a REPL which is strange for a BEAM VM language.

cies a day ago

I like all these langs that bring stricter typing to ecosystems that do not traditionally have very strict typing. Gleam for BEAM (Erlang), Kotlin/Scala for JVM (Java), Elm/PureScript/TypeScript for JS engines, Borgo for Go.

Life's too short for runtime errors.

  • frabcus a day ago

    Pyright with Python is lovely too!

lolinder a day ago

> First and foremost, their statement about community on their homepage spoke to me

This is the part of the excitement around Gleam that gives me pause. When the biggest draw is the heavily-moderated community [0], it seems almost more a political project than it does a technical one. That's not a bad thing in and of itself—goodness knows we need less toxicity in the world—but I get very nervous around a technical project that has gotten very comfortable with silencing dissent and enforcing "good vibes". I think of dang's bio quote:

> Conflict is essential to human life, whether between different aspects of oneself, between oneself and the environment, between different individuals or between different groups. It follows that the aim of healthy living is not the direct elimination of conflict, which is possible only by forcible suppression of one or other of its antagonistic components, but the toleration of it—the capacity to bear the tensions of doubt and of unsatisfied need and the willingness to hold judgement in suspense until finer and finer solutions can be discovered which integrate more and more the claims of both sides. It is the psychologist's job to make possible the acceptance of such an idea so that the richness of the varieties of experience, whether within the unit of the single personality or in the wider unit of the group, can come to expression. [1]

Marion Milner, 'The Toleration of Conflict', Occupational Psychology, 17, 1, January 1943

[0] The lead dev has been known to tell people off in DMs for reacting with negative emoji to their discord comments (and remove the negative reactions with admin powers!): https://news.ycombinator.com/item?id=41413735

[1] https://news.ycombinator.com/user?id=dang

  • hellcow a day ago

    I'm more interested in the language after hearing this. There's plenty of negativity in the world, I don't need more of it in a niche programmer forum of enthusiasts. It reminds me of MINASWAN from Ruby.

    • lolinder a day ago

      MINASWAN is a cultural thing, not a code of conduct. It's not enforced by Matz from on high in such heavy-handed ways, it's just the way that the Ruby community rolls.

      That said, if this interests you, that's great! Like I said, there's nothing wrong with a project that is primarily political in nature. I'm just highly skeptical that such a project can achieve good technical outcomes in the long run once the admins get accustomed to suppressing negative reactions under a vague "good vibes" policy.

      I could be wrong, and that's exactly what political projects are often designed to do: to prove a political point. But if you're not interested in a political project and are instead looking for a strongly typed BEAM language, you might be better off just waiting for Elixir to finish its types.

  • brink a day ago

    Isn't it funny that people who constantly feel the need to tell the world how kind they are, actually aren't that kind?

    • laurent_du a day ago

      It stops being funny when you realize the root cause of this posturing is mental health issues. These people are unwell.

  • okkdev a day ago

    Not tolerating intolerance shouldn't be political.

    • lolinder a day ago

      As many are fond of saying these days, everything is political, whether it tries to or not. But what makes me say this is a political project more than a technical one is that consistently, as in TFA, the thing people say draws them to Gleam is this statement on the home page.

      And again: lpil has explicitly said that they're not stopping with intolerance, they enforce "good vibes". That's what I'm worried about on a practical level: I don't believe you can build a healthy technical community that solves real problems on that foundation.

      I very well might be wrong, and I believe that that's the point of this political experiment. But I also think it's important to emphasize that that's what this is: a political experiment, not just a programming language.

      • okkdev 15 hours ago

        I really think you read too much into this. It's a programming language by people who don't want to deal with shitty people. There's more than enough healthy language design discussion going on if you are worried about that.

    • DemocracyFTW2 a day ago

      This is an automated message. Your SocialScore has been downgraded 1.75% for using two negations in a single sentence. Please be more positive in the future. Thank you.

  • garyrob a day ago

    Just gotta say that's an excellent quote from dang, who I never heard of before.

    • lolinder a day ago

      Hah, fair enough. Proper citation added.

  • beepbooptheory a day ago

    I guess I just don't understand how you want to draw the line from the need for tolerance in itself to the necessary prescription that quiescence is the only way to be if you want to get things done. Is not taking some kind of stand precisely integrating and accepting conflict?

    Like is anything purely technical? I dont think so, and the most insidious politics are the ones that are left unspoken but allowed to direct the endeavor at hand. To dream of or push for something purely "technical" or "apolitical" is simply to be guilty of the same thing your quote is getting at, but from the other direction. Instead of squashing dissent, you simply poof it out existence, you make it taboo to even talk about. How does that then become tolerance? How does it operate necessarily to help us? It is in fact no less an imposition, and is no less a political operation in the communities where this kind of view operates.

    • lolinder a day ago

      Okay, replying now to what you actually meant (my other comment assumed that you were saying that Gleam advocates for tolerance, I didn't realize it was a reference to the quote):

      I said nothing about quiescence. I said nothing against taking a stand. My opposition is to the idea that the way forward for conflict management is to purge it and pretend it isn't happening. That's what happened in the case I linked to—a member of the community expressed disapproval of admin actions and had their disapproval removed by the moderator and received a rather passive aggressive response in a DM. That's an inappropriate way to moderate that does not lead to healthy conflict management.

      Taking a stand would be publicly engaging with the criticism, not purging it and engaging with the critic in a private message.

      I'm much less concerned about the US-politics-centric commentary on the main page (though there are problems with that, like making people not in the US feel excluded) than I am with a broader trend in many open source projects (this one being one of several I've seen) of "protecting" their community from anything that remotely resembles toxicity, even when those things are well meaning criticism of the way that things are being run.

      And no, I wouldn't say that anything is purely technical—but some things are political in service to the technical, and other things are political first. Gleam strikes me as a project that is firmly political first, based on the lead dev's actions and the community's discussion (this article literally places the project's political stance as "first and foremost"!). As I say, that's not a bad thing, but I'm skeptical that it will work out in the long run on a technical level to prioritize the politics over all else, especially when the approach to politics is one that shuts down conflict rather than cultivating and curating it.

    • lolinder a day ago

      > to draw the line from the need for tolerance in itself to the necessary prescription that quiescence is the only way to be if you want to get things done

      I'm not talking about tolerance, I'm talking about the lead dev actively shutting down negative reactions to their comments and justifying it under the banner of "good vibes". If the lead dev can't deal gracefully with criticism, that's going to be a problem.

      Too many people in this thread are treating criticism of this pattern of silencing dissent for not "vibing" right as though the critic is implicitly endorsing letting Nazis roam free. There's a middle ground between "good vibes only" and "fascists welcome" that lpil has explicitly said he's not interested in pursuing.

      • beepbooptheory a day ago
        2 more

        Its totally fine and reasonable if this is just about how this particular person carries themselves, about them being a bad admin or whatever! It just then feels a little at odds with sweeping, principled profundity of the initial comment. Like why invoke the quote and all that at first if you're not actually standing by it now?

        • lolinder a day ago

          I don't know where you get that I'm not standing by it—the quote isn't about tolerance, it's about engaging with difficult concepts and conflicts rather than dodging them. I didn't even realize your talking about tolerance was supposed to be engaging with the quote until this follow up.

          I guess "toleration" and "tolerance" do share a root, but the latter is so watered down at this point that I honestly didn't even connect them, so I misunderstood your comment to be about something very different than it was. I'm going back now to reread it to see if I can understand your point better.

          Edit: rather than deepening this subthread further, I posted a separate reply to your original comment based on my new understanding of your point.

zellyn a day ago

Wow. I invite everyone to go actually read the Gleam’s homepage: https://gleam.run/

After reading the discussion here, with our poor community being “blinded by pathetic posturing” and such, I was expecting some kind of political polemic plastered over everything.

Here’s the sum total of everything that could be considered political from the page:

Friendly

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.

Which part of that can you possibly find objectionable? It seems the mere mention of anything political is seen as a transgression somehow. Like, Can’t we just go back to pretending we’re entirely apolitical, while the technologies we build reshape the political landscape of the entire planet?

  • lolinder a day ago

    Since I'm assuming you're at least half replying to me: I'm not objecting to any single part of that. I'm speaking of interactions I've had with the lead dev on this forum (linked in my comment) where they explicitly said that they don't stop at that and don't see any problem with enforcing "good vibes" on their community (their words), in a discussion that started with someone complaining that said lead dev had removed a negative emoji reaction that they had received on one of their own comments.

    Take the politics any way you like, I don't think you can build a healthy technical community that will solve problems in a healthy way under an admin who is casual in removing expressions of dissent about their moderation practices, justified under a policy as vague as "good vibes".

    https://news.ycombinator.com/item?id=41413735

GiorgioG a day ago

> First and foremost, their statement about community on their homepage spoke to me

This will probably get me downvoted to hell, but here goes anyway. You know, sometimes I just want programming stuff to be about programming. If I want social justice I will go to the appropriate place. No I don't support Nazis or the like, but there's a shitload of other types of discrimination/injustices that I (and most others) also don't support, that we don't see plastered everywhere.

  • arrowsmith a day ago

    FWIW, it's not just the "community statement" - the creator of Gleam is very unshy about his politics. Just take a glance at his social media.

    He has every right to do so, obviously, and I'm not telling him to stop. But if you want a programming community that keeps its politics separate from work, Gleam is not for you.

    • bn-l a day ago

      It’s not for me.

  • mmcromp a day ago

    Not everything has to be for everyone. If you don't like the sentiment, then maybe it's not for you and that's ok.

  • kubb a day ago

    > This will probably get me downvoted to hell

    In my experience the people who get irked by public support for groups suffering from hate always have this persecution complex, like they're going to be subjected to the same treatment as the members of these groups that they don't like to see being defended.

    People have a platform, and they use it to show they views. Elon does nazi salutes, Louis says trans rights. They express what they believe in.

    • theoreticalmal a day ago

      Interesting, my experience is the opposite

      • kubb a day ago

        Opposite how? It's not clear what the opposite of what I expressed is.

    • fortran77 a day ago

      These groups still hate. It’s just that Gleam’s creator hates the same people you hate so you’re ok with that.

      • felixgallo a day ago
        2 more

        There is definitely not a symmetricality to this. Gleam's creator apparently wants all people to get along, and for fascists to go fuck themselves. There's no 'both sides' to Nazis, fella.

        • fortran77 a day ago

          Yes. But—-shockingly IMHO— ‘Nazi’ doesn’t mean what it used to.

      • kubb a day ago

        It could be but the political statement in question doesn't call for hate on anyone (not even nazis).

  • cardanome a day ago

    I understand the idea of just focusing on the code and leaving politics aside. Sadly that is not how it works.

    Those statements are necessary so people know it is safe to engage with this community. So women know they are less likely to be openly harassed and demeaned. So trans people know they are allowed to exist in this community. So that black people know they will not be bombarded by racism.

    An yes you have to be proactive and drive out Nazis or they will take over your community over time. You can not tolerate those that show intolerance.

    Choosing to "not be political" means choosing to be inclusive to Nazis and to be dangerous for nearly everyone else.

    • arrowsmith a day ago

      Which programming communities don't allow trans people to exist, bombard black people with racism, or have been taken over by Nazis?

    • GiorgioG a day ago

      > Choosing to "not be political" means choosing to be inclusive to Nazis and to be dangerous for nearly everyone else.

      That's a fucked up take. I guess because Gleam doesn't explicitly call out pedophiles, rapists, murderers, and other low-lifes that they must be inclusive of those folks too right? Gleam is so dangerous for everyone else as a result. /s