我对 Gleam 的印象

  • Introduction (22 Jan 2025 4 min read): About to go on paternity leave when Gleam reached 1.0. Tried converting a GitHub Action from JavaScript to Gleam but faced issues. Ended up learning and using ReScript but still liked Gleam and did a new project with it during winter holidays.

    • Why Gleam: Community values (friendly, inclusive, anti-nazi), small and tightly designed, typed, functional, immutable and impure language with a nice balance of practicality, compiles to Erlang or JavaScript, has Lustre for FFI, and a friend is a fan.
    • My learning project: Created a website to help choose a coding font using Lustre and Gleam. The project was abandoned as CodingFont came out with a similar approach. The code is available on GitHub.
  • The good: Pleasure to work with, functional typing had benefits, language was small and easy to keep in mind, powerful with Lustre and used less than 200 lines of Gleam code along with less than 90 lines of HTML and CSS.
  • The bad: Didn't like curly braces as a Python fan, and having to specify a type's name twice for the type and constructor in a record.
  • The dream: Would love a WebAssembly/WASI and Python back-end for Gleam along with Erlang and JavaScript. There are notes on writing a Python back-end and a prototype by a friend, but not sure if it will happen as the compiler is written in Rust and not designed for adding more back-ends.
  • Conclusion: Happy with Gleam, interested in trying it with Erlang and the BEAM, next project is with Elixir but doesn't regret learning Gleam and is working on Exercism's Gleam track.
阅读 8
0 条评论