gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
17.43k stars 723 forks source link

Improve "Unknown module field" error message #3534

Closed giacomocavalieri closed 3 days ago

giacomocavalieri commented 3 weeks ago

I think the error message we get when trying to access a module function that doesn't exist could be improved. Right now it looks like this:

Screenshot 2024-08-19 alle 20 13 49

Calling it "module field" strikes me as a bit odd, I've never heard this term before. Maybe it could be worded a bit differently:

+error: Unknown module function
-error: Unknown module field
   ┌─ /Users/giacomocavalieri/Documents/progetti/ssg/build/packages/jot/src/jot.gleam:20:11
   │
20 │       dict.update(attributes, key, fn(previous) {
   │           ^^^^^^^

+The module `gleam/dict` does not have a `update` function.
-The module `gleam/dict` does not have a `update` field.
lpil commented 3 weeks ago

How about "module value"?

We do use the term "field" both in the language though, internally and in errors and warnings and documentation.