News for hackers. Stuff that matters.
Re:Type Inference That Sticks by jbandela1 on Sunday February 05, 2023 @08:32AM (#34664745)
I think JetBrains actually does something like this. When writing Rust or Kotlin or C++ (these are the ones I have used) the editor will annotate the inferred types with the actual type and you can see it in the editor (with a slightly different font to differentiate).
Re:Type Inference That Sticks by realharo on Sunday February 05, 2023 @09:12AM (#34665014)
VS Code also supports inlay hints for both inferred types, and parameter names https://code.visualstudio.com/docs/typescript/typescript-edi...

I think it's turned off by default for most languages though - probably considered unnecessary, as you can always just hover over the variable. Also, unlike the JetBrains IDEs, I don't think you can Ctrl+Click on such a hint to navigate to its definition in VS Code (like you can in normal code).

Re:Type Inference That Sticks by MrJohz on Sunday February 05, 2023 @09:39AM (#34665232)
You can if the LSP enables it, I believe. In rust-analyzer, it's definitely possible to do this, for example, but I think that was a new feature added somewhere in the last few releases.
Re:Type Inference That Sticks by cma on Sunday February 05, 2023 @09:55AM (#34665360)
Regular Visual Studio has this now too, at least for C++.
Re:Type Inference That Sticks by jaredly on Sunday February 05, 2023 @10:20AM (#34665559)
Yeah, it is definitely nice to have inferred types surfaced to you, but in these systems they are still re-computed on every textual edit, as opposed to being "sticky" (persisted in the source tree).
Re:Type Inference That Sticks by brundolf on Sunday February 05, 2023 @11:26AM (#34666132)
Lots of IDEs do that for lots of languages these days, and it's wonderful, but I don't think that's the kind of thing they're talking about here in the article
Re:Type Inference That Sticks by IshKebab on Sunday February 05, 2023 @11:43AM (#34666319)
Yeah they're talking about recording the type inferences in the source code. Interesting idea but I feel like it might fall down the same way all "not just text" ideas fall down - the whole coding world is built around plain text. Git, diff, GitHub, IDEs, etc.

Some inferred types in Rust can be pages long. Have fun with those merge conflicts!