Live data from Hacker News

John Carmack: writing Rust code feels wholesome

twitter.com

31–40 of 85 posts

Re: John Carmack: writing Rust code feels wholesome

#31
post #20

Earlier quoted context omitted.

vscode has pretty good support for rust. If you need something more advanced, you can try clion from jetbrains with the intellij-rust plug-in.

Vscode is what I tried. It was critically flawed where the autocomplete would crash or be missing half the options you'd expect. I will need to try again. It's been six months.

Same experience here. Was learning rust with vscode, and it would only show half of the compiler error output (e.g. the part that recommends how to fix the error wasn't shown).

In the latest vscode release they now support multiline error messages so maybe the situation will improve.

Re: John Carmack: writing Rust code feels wholesome

#32
post #27

Earlier quoted context omitted.

Vscode is what I tried. It was critically flawed where the autocomplete would crash or be missing half the options you'd expect. I will need to try again. It's been six months.

I can vouch for CLion with intellij-rust, it is by far the best Rust editor/IDE available at the moment. RLS still suffers from slow/no auto completion and crashes too much for my liking. The pace and features that are coming out of the team working on intellij-rust is amazing: https://intellij-rust.github.io/thisweek/ .

Rust is so exciting to me that I'll probably do this. But I absolutely HATE having to maintain multiple editors. It's like playing two pianos where the keys are all in different places. I will spend hours trying to make one like the other but it'll just never quite be right so my coding rhythm. will be discordant and janky.

I wish there was a trivial way to say to intellij, "steal all my config from vscode"

Re: John Carmack: writing Rust code feels wholesome

#33
post #20

Earlier quoted context omitted.

vscode has pretty good support for rust. If you need something more advanced, you can try clion from jetbrains with the intellij-rust plug-in.

Vscode is what I tried. It was critically flawed where the autocomplete would crash or be missing half the options you'd expect. I will need to try again. It's been six months.

As a fan and user of both Rust and VS Code, it's still pretty bad. It crashes less than it used to six months ago, but the autocompletion is still near useless. It doesn't support traits as far as I can tell, for example.

Re: John Carmack: writing Rust code feels wholesome

#34
post #3

C++ continues to lose mind-share. When will the community acknowledge that their tooling is lacking?

C++ is actually doing very well, and the community is very well aware that C++ tooling sucks. It's just not an easy problem to solve because it has such a huge amount of existing code and projects.

Absolutely!

I think the important question is, what will happen first:

(a) C++ gets better tooling around build systems and package management; or

(b) Rust libraries are written for all of the things that we care about?

Certainly in the HN bubble it feels like (b).

Re: John Carmack: writing Rust code feels wholesome

#35
I looked seriously at rust about 2 years ago. I seem to have tried the language at the wrong time .. they were transitioning between versions and this made learning it hard. I grew up with C so am very comfy with pointers. Even reference counting feels natural to me. That said, the borrowing/ownership semantics of rust (at the time I looked at it) felt needlessly over complicated. Has this got better? Is there a K&R equivalent that an experienced programmer can get pick up to get productive with the language soon?

Re: John Carmack: writing Rust code feels wholesome

#36

I looked seriously at rust about 2 years ago. I seem to have tried the language at the wrong time .. they were transitioning between versions and this made learning it hard. I grew up with C so am very comfy with pointers. Even reference counting feels natural to me. That said, the borrowing/ownership semantics of rust (at the time I looked at it) felt needlessly over complicated. Has this got better? Is there a K&R…

>That said, the borrowing/ownership semantics of rust (at the time I looked at it) felt needlessly over complicated.

Isn't it just “one mutator at a time”?

>Is there a K&R equivalent that an experienced programmer can get pick up to get productive with the language soon?

(Opinion incoming.) The Rust Book[1] is great iff you are a complete beginner. If you are an experienced programmer, who knows his way around concepts like resource management and ownership, it's kind of a drag. Rust by Example[2] is much better. The Nomicon[3] is interesting, but it's mostly about unsafe.

[1] https://doc.rust-lang.org/book/

[2] https://doc.rust-lang.org/stable/rust-by-example/

[3] https://doc.rust-lang.org/nomicon/index.html

Re: John Carmack: writing Rust code feels wholesome

#38

I looked seriously at rust about 2 years ago. I seem to have tried the language at the wrong time .. they were transitioning between versions and this made learning it hard. I grew up with C so am very comfy with pointers. Even reference counting feels natural to me. That said, the borrowing/ownership semantics of rust (at the time I looked at it) felt needlessly over complicated. Has this got better? Is there a K&R…

>the borrowing/ownership semantics of rust (at the time I looked at it) felt needlessly over complicated.

Taking a wild guess here, but it sounds like you maybe referring to issues addressed by Non-Lexical Lifetimes (NLL)?

Reference: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll....

NLL are a part of Rust 2018 Edition.

Three complementary books are the best resources:

- The Official book: https://doc.rust-lang.org/book/

- The Rust By Example book : https://doc.rust-lang.org/rust-by-example/

- Programming Rust (O'Reilly) : https://www.amazon.com/Programming-Rust-Fast-Systems-Develop...

Re: John Carmack: writing Rust code feels wholesome

#39
post #4

Many comments in twitter mentions rust still not being ready for server code ( which i start to feel strange since concurrency is the only major issue on the server side, and supposed to be rust strength). Anyone can confirm ?

This is because of the removal of the fat runtime and green threads about 5 years ago. Since there was no blessed way to do high concurrency in the language any more, some code started using normal threads, some code (tokio) started using normal callbacks. Callbacks in rust are tricky because of the type system. Around a year ago, async/await became possible due to the development of the Pin idea. async with the await! macro is usable now, but the rust community has been bikeshedding over built-in await syntax and last time I looked that discussion was still raging.

So you can write scalable servers using normal threads, normal callbacks, and async with the await! macro, but not the final async/await syntax because the community hasn’t even finished deciding what it is. Porting code between these approaches is also not particularily easy. I have seen example code for rust networking libraries that uses all of the different approaches, but mixing the different approaches is also difficult. So that’s probably why people say it’s not ready even though you can write code right now that will work just fine. The “final” way of writing it isn’t ready yet, and if you write one of the current forms, porting to the final form will be a pain.

Re: John Carmack: writing Rust code feels wholesome

#40

I looked seriously at rust about 2 years ago. I seem to have tried the language at the wrong time .. they were transitioning between versions and this made learning it hard. I grew up with C so am very comfy with pointers. Even reference counting feels natural to me. That said, the borrowing/ownership semantics of rust (at the time I looked at it) felt needlessly over complicated. Has this got better? Is there a K&R…

I've been programming in C and C++ since sometime around 1992 (and Pascal before that). For the last 3 years, I've been writing Rust professionally.

Here's my Rust advice for C and C++ programmers:

- Rust is a higher-level language than C. A C/C++ programmer could think of Rust as "C++ without most of the footguns and magic."

- Certain types of C/C++ code will translate very easily to Rust. For example, if your code mostly transforms bytes (or data structures) into other bytes (or data structures), then Rust will usually be fairly easy to learn. We could call this "mostly functional" C code, with only localized mutability, and with clear, hierarchical data structures. Examples: Most typical Unix CLI tools.

- Certain kinds of C and C++ will translate very badly to Rust. If you have a big web of mutable objects, all of which point to each other and update each other, then your first experience of Rust will probably be frustrating. Examples: doubly-linked lists, traditional GUIs, typical video games. You can do all these things in Rust, but you'll need to either re-architect them or use more advanced features. (See http://cglab.ca/~abeinges/blah/too-many-lists/book/ for doubly-linked lists, or https://kyren.github.io/2018/09/14/rustconf-talk.html for video games.)

- Async Rust is not ready for prime-time. We make limited use of async Rust at work. It's rock-solid and powerful, but it's missing critical ergonomic features and it demands a surprisingly high level of Rust knowledge. See https://areweasyncyet.rs/.

Two good Rust books are https://doc.rust-lang.org/stable/book/ and http://shop.oreilly.com/product/0636920040385.do. "The Rust Programming Language" seems to work best for people coming from Ruby or JavaScript, but I've known several C/C++ programmers who preferred the O'Reilly book.

Honestly, if you're happy with C, there's no reason to switch to Rust. (Except, maybe, preventing exploits, if you worry about that.) If, however, you love certain parts of C++ and hate other parts of C++, then Rust might be worth a look. Anyway, that's my personal take. :-) Overall, I've been really enjoying Rust. It generates fast, reliable code and it fits the way I think.

Post reply on HN