Live data from Hacker News

Gleam v1.12

github.com

51–60 of 91 posts

Re: Gleam v1.12

#51
post #2

Some highlights from this release are listed here[1]. The best part of Gleam in my opinion is the language's design. It's just so elegant to read and write. Take this example code snippet from the release notes: pub fn find_book() -> Result(Book, LibraryError) { case ask_for_isbn() { Error(error) -> Error(error) Ok(isbn) -> load_book(isbn) } } It's a trivial code snippet, but I'm finding this kind of "first class" pa…

snake case convention is the only thing that always feels odd to me. Perhaps its because I deal in TypeScript all day, every day, but it never stuck with me. That said, small price to pay for a very nice runtime!

I come from js/ts as well and I find snake case much more readable than camel after using it in other languages for a bit. There are even js/ts projects that use snake case despite the camel case convention, for readability

https://github.com/sveltejs/svelte/issues/3479#issuecomment-...

Re: Gleam v1.12

#52

The official website has an interesting footer > 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. On one hand I applaud that their community standards are inclusive, but on the other hand, it shou…

I've never used Gleam and really don't care either way about the creator's politics, but it would be nice to see Gleam hit the HN front page for once without this same tedious conversation getting repeated every time.

Isn't there something more interesting we can talk about?

Re: Gleam v1.12

#53
post #20

Earlier quoted context omitted.

This is a trivial snippet. Often you will transform/map your error into another type (or deal with it in some way), so it's not so much `if err != nil { return err; }` vibes like you're thinking here. The beauty here is being compelled to handle both the happy and sad paths. You cannot just pretend the sad path doesn't exist.

Good Go code also wraps errors...

It's not just about wrapping. use-expressions, result.try and result.map eliminate the boilerplate of checking for errors entirely: https://erikarow.land/notes/using-use-gleam

Re: Gleam v1.12

#54
post #51

Earlier quoted context omitted.

snake case convention is the only thing that always feels odd to me. Perhaps its because I deal in TypeScript all day, every day, but it never stuck with me. That said, small price to pay for a very nice runtime!

I come from js/ts as well and I find snake case much more readable than camel after using it in other languages for a bit. There are even js/ts projects that use snake case despite the camel case convention, for readability https://github.com/sveltejs/svelte/issues/3479#issuecomment-...

Yeah, CamelCase for modules, snake_case for functions and variables.

Your brain can instantly tell what entity you’re dealing with.

Re: Gleam v1.12

#56

Earlier quoted context omitted.

>It's just so elegant to read and write. Interesting. I was just about to write the opposite. I tried Gleam to solve last year's Advent of Code, and it felt like a weird mix between Rust and Elixir. You can't write code as elegantly as you'd do in Elixir, which was somewhat disappointing. I switched back to Elixir after a couple of days. I think the biggest advantage of Gleam is static type system.

I prefer Elixir's syntax over Gleam's, but my main issue with Gleam is architectural. Specifically, Gleam had to bastardize BEAM and OTP to implement static typing. To me, static typing vs. dynamic typing is like having a shelf with a doily vs. one without a doily (the shelf works fine either way), so messing up a solid Actor Model implementation, for instance, for the sake of static typing seems like the wrong thing…

How does it bastardize the beam? Like are there things you can do in elixir/erlang that you couldn’t with gleam?

Re: Gleam v1.12

#57
post #27

Earlier quoted context omitted.

Being anti-nazi is not ideological.

Of course it is. You can't be against anything without an idea, without it you wouldn't be opposed, you'd just not give a shit. Not caring isn't ideological just like not believing in god isn't, but being anti-god? That's pure ideology.

Sure but 'not giving a shit' means accepting Nazism.

Re: Gleam v1.12

#58

Earlier quoted context omitted.

[flagged]

HN itself has quite a lot of "nazi bullshit." You don't usually , regularly see people being virulent about it but people frequently endorse policies that would absolutely have fit cleanly into the historical nazi party's platform. Things like race science and eliminationist policies against the homeless, anti-immigration stances, homo- and transphobia are particularly popular. People here are normally "polite" about…

[flagged]

Re: Gleam v1.12

#59

Earlier quoted context omitted.

I prefer Elixir's syntax over Gleam's, but my main issue with Gleam is architectural. Specifically, Gleam had to bastardize BEAM and OTP to implement static typing. To me, static typing vs. dynamic typing is like having a shelf with a doily vs. one without a doily (the shelf works fine either way), so messing up a solid Actor Model implementation, for instance, for the sake of static typing seems like the wrong thing…

How does it bastardize the beam? Like are there things you can do in elixir/erlang that you couldn’t with gleam?

I'm curious to know what the parent meant, as well. My understanding, which is incomplete admittedly, is that Gleam's type system lives in Gleam and isn't carried over into the produced Erlang/BEAM code, since BEAM has no concept of types, etc.

Gleam also has an OTP implementation[1] available, which includes Actors and the like. My understanding is that every BEAM language must implement OTP themselves, so there's nothing unusual here.

[1] https://hexdocs.pm/gleam_otp/

Re: Gleam v1.12

#60

Earlier quoted context omitted.

Good Go code also wraps errors...

It's not just about wrapping. use-expressions, result.try and result.map eliminate the boilerplate of checking for errors entirely: https://erikarow.land/notes/using-use-gleam

One man's boilerplate is another man's explicitness.
Post reply on HN