Perhaps there has been some discussion of this, but I could find it after some quick searches here and in GitHub. I would like to float the idea of adding short, explanatory links to compiler error messages and other messages in OCaml platform tools. I think this would be a usability and developer experience win. It could look like this:
utop # 1+();;
Error: This expression has type unit but an expression was expected of type int
🔗 ocaml.org/t/type-error
utop # M.foo ();;
Line 1, characters 0-5:
Alert deprecated: M.foo
Use bar instead
🔗 ocaml.org/t/alert
This could be done not just for compiler messages but for any tools under the OCaml umbrella, including dune and opam.
It would require coordination between these tools and the ocaml.org website. I have filed an issue there to propose supporting these shortlinks: Implement shortlinks · Issue #916 · ocaml/ocaml.org · GitHub
It would basically be a URL shortener, conceptually similar to golinks or similar shorteners used by companies and people. We would need to maintain a set of mappings from the shortcuts to the expanded urls, e.g.:
alert=https://v2.ocaml.org/manual/alerts.html
type-error=https://v2.ocaml.org/manual/coreexamples.html
The ocaml.org server would have access to these mappings and would redirect from the shortlink to the target link. This level of indirection has the obvious benefit that the redirect targets can be changed and improved over time, while preserving the shortlinks.
I know what you’re thinking–doing this could potentially require coordinating across two different repos, or doing two discrete actions, whenever any tool wants to include a shortlink in its output. But, I think it’s worth it because of the user experience benefits. It would I think also obsolete the need for error message identifier numbers like some other compilers have–the shortlinks could uniquely identify each message.
3 posts - 2 participants