5 ms·
I've never written rust, so maybe this is way off. But could the code editor display the inferred type right next to the variable declaration?
by williamscales 4y ago
I've never written rust, so maybe this is way off. But could the code editor display the inferred type right next to the variable declaration?
- twicetwice 4y agoYes, I believe rust-analyzer language server + vscode extension is the setup I have that does this for me.
- cauthon 4y agoYes, highly recommend this setup. Displaying inferred type + compiler errors has been amazing while learning Rust.
- toast0 4y agoIt could, but then you put off grumpy people like me with old editors that don't do that kind of thing. Plus you need fancy tools to look at patches. And none of it is going to work inside tokio's select macro (or other useful macros), which could be a lot of your code, depending on what you're writing. I'd rather work in a language where nobody has type information. It's a much more even playing field. ;p
- bryanlarsen 4y agoWhat are you using for an editor? Both emacs and vim can do that kind of thing.
- toast0 4y agoI use joe. I've been using it for 25 years at this point, and it works enough, and I'm not interested in changing. About 15 years ago, I upgraded to a version of joe with syntax highlighting which was pretty cool, but I'm not much interested in more than that. I do occasionally poke around with things in fancy IDEs (it's easier to fiddle with Arduino projects with an IDE than otherwise, because nobody writes about how to do the pieces individually... but maybe I can drive platform.io from the command line in the future), but I'm much happier with a simple as dirt editor, and another terminal to run Make in (or whatever, using Rust for work now, so running cargo instead of make).
- moonchrome 4y agoIMO a decent editor is a must for statically typed languages - it's such a productivity boost to navigate by type information, type safe refactoring, etc. Main benefit of static typing is enabling tooling to reason about your code - not using IDEs is throwing a huge chunk of it away. Historically it was easy to get projects that would be too large for real-time tooling - but these days the IDEs got better and you can get 32 or even 64 GB ram into a workstation trivially - I haven't seen a scenario like that in years. I've also noticed GitHub supports type navigation in some languages, but yeah for nontrivial reviews I'll usually do a checkout anyway.
- WJW 4y agoI get what you mean but it does come across a bit as "why would anyone want C compiler, ASM provides a much more even playing field". All of the "old" editors that people still use have LSP plugins these days, so feel free to treat yourself any day now. :) Non-sarcastically: type systems have their place but are not quite there yet. I say this as someone currently doing Advent of Code in Haskell, which surely cannot be accused of being lacking in type safety. What I would love to see in a type system is the flexibility that (for example) Rails' ActiveRecord adds to a class while still being type-safe. AFAIK, no such system exists (yet) but I would love to be proven wrong sometime in the future.
- c0balt 4y agoMost editors (or plugins for them) that support a LSP, like rust analyzer[0], can do it. This includes afaik (neo)vim (via coc.nvim), vscode (via rust-analyzer extension), emacs and Clion. [0]: https://rust-analyzer.github.io/ https://rust-analyzer.github.io/
- Jorengarenar 4y ago>(neo)vim (via coc.nvim) I think vim-lsp and Neovim's native LSP both have it too
- c0balt 4y agoThank you for pointing these out. I personally use coc but vim lsp was also a good experience. This lost is by far not complete as many other editprs also support LSP servers, like helix.