Is it possible and/or useful to (optionally) show inferred types in code browser, pull requests / diffs? #50011
Replies: 1 comment
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Feature
Hello - I am wondering if it would be possible, that for languages with type inference, the code browser as well as pull requests / diffs, show inferred types for top-level values, as well as intermediate values when the user hovers over them - very much like how VSCode shows them, typically by querying type information from an implementation of the Language Server Protocol (usually provided as a language-specific extension).
I expect that this would only work for code for which type inference / compilation actually worked, and the inferred types were somehow also made part of the git repository.
Rationale
For languages with powerful type inference (e.g. SML, OCaml, Haskell, even C++11, ...), programmers tend to think in types, and they are often the most important part of the code. Knowing the types and shape of data vastly improves the readability of code in such languages.
It may also happen in some cases, when looking at a diff, that a piece of code is syntactically unchanged, but the inferred types have changed due to a change somewhere else - but the code reviewer is not alerted to this change at a location where it might be important (e.g. an IPC/serialization boundary).
Downsides
Beta Was this translation helpful? Give feedback.
All reactions