Exploring Gleam, a type-safe language on the BEAM! (christopher.engineering)
from popcar2@programming.dev to programming@programming.dev on 11 Jun 11:04
https://programming.dev/post/15376856

#programming

threaded - newest

Carighan@lemmy.world on 11 Jun 11:17 next collapse

I mean that’s pretty neat, but I’m reminded of that time a MongoDB user found an SQL-based database and wrote a lengthy article about all of the revolutionary features. Feels the same every time a Javascript dev discovers a programming language with actual typing.

Seems cool, but also… normal? That’s how languages should all work?

dneaves@lemmy.world on 11 Jun 16:42 next collapse

That’s how languages should all work?

While I agree, should be is not is. Also, Javascript is still a widely used and favored language, despite it’s flaws.

Sometimes people need to be convinced that there’s something better, hence all the articles of “Javascript devs discovering actual typing”, as you mentioned. Although it seems like the author already knew there’s better (I see Typescript and Rust on their Github), that they were just sharing Gleam.

As for specifically Gleam, I will say it’s a very nice language. Very simple to understand (with one minor exception: I personally find the use keyword is a bit odd), strong typing, no collections of mysterious symbols (cough, Haskell), no metaprogramming, no lifetimes, no borrowing, no unclear polymorphism, no pointers, no nonsense. I like it, and am excited to see it grow

barsquid@lemmy.world on 11 Jun 20:44 collapse

I didn’t check this out but I thought BEAM was Erlang?

0x1C3B00DA@fedia.io on 11 Jun 21:59 collapse

BEAM is the VM that Erlang runs on. It also supports Elixir and some other lesser known languages

gerryflap@feddit.nl on 11 Jun 12:12 next collapse

Sounds cool. The types like Haskell’s data types or Rust’s enums compared with proper pattern matching are pretty much a requirement for a good language imo. And the process/message passing is interesting.

excel@lemmy.megumin.org on 11 Jun 18:17 next collapse

NGL, this looks kinda terrible

tatterdemalion@programming.dev on 12 Jun 01:57 collapse

Gleam is cool. I wrote some services with it to see if I wanted to use it for more projects. It seemed like a good option because it would be easy to teach.

Things I like:

  • fast build times (I only tested small apps though, under 2000 LOC)
  • strong static types
  • runs on the BEAM
  • easy to learn
  • pattern matching
  • immutable + structural sharing
  • currying (with parameter holes)

Things I don’t like:

  • no re-exports
  • it’s possible to have name collisions between packages; authors have a gentleman’s agreement to always create a top-level module with the same name as the package
  • some standard library APIs seem missing or immature (it’s still pre-1.0)
  • it can be hard to get good performance out of idiomatic code for specific tasks (see immutability)
  • no format strings; best you can do is "Hello, " <> name. It starts to get cumbersome
  • parsing/serialization is all quite manual boilerplate; there’s nothing quite like serde
  • no field/argument punning
  • no method syntax; you just have to scan the docs to figure out what functions can be used with a given type
  • you can’t define the same variant name twice in the same module; I believe this is a limitation in how the types are translated to Erlang records
  • you can’t call functions in pattern matching if guards
  • you can’t have dependency cycles between modules in the same package
  • hard to write FFI correctly; you lose all the comfort of types