TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Should I learn Rust or Go?

78 pointsby LecroJSalmost 3 years ago
I am a full stack TypeScript dev looking to broaden my skill set by learning a new language. I’ve been weighing Rust vs Go for a long time but can’t really decide which would be a better use of my time. I often hear that people who try one of these languages after coming from something like TypeScript feel that they really level up their abilities&#x2F;understanding.<p>I’d like to learn whichever language will make me a “better” coder in the long term. My understanding is that Rust would be the way to go here. However, I see that the Rust learning curve is significantly higher than Go’s, and that something like setting up a server in rust will take much longer than Go. It sounds like Go is better for “getting things done” but I’m wondering if I’m leaving growth&#x2F;understanding on the table by going from one garbage collected language to another.<p>I am interested in hearing anyone’s thoughts on this matter. Especially if you have experience going from js&#x2F;ts to one of these.<p>Thanks and happy 4th

52 comments

ankrgylalmost 3 years ago
If your goal is to be a better coder long term, I’d suggest learning both. As many have pointed out, Go is quick to learn, and I think learning both will only take a small amount of extra time (compared to learning Rust).<p>They each present trade offs that make them a better tool under particular circumstances. While Rust exposes you to more sophisticated typesystem features, Go&#x27;s M:N scheduler is an incredible piece of technology that is (IMO) unmatched by any other mainstream language.<p>Finally, regarding the garbage collector, if you learn both languages, you&#x27;ll get to viscerally experience the tradeoffs of having the garbage collector (try writing the same program in each language). There are some projects where it makes sense to use one and others where you shouldn&#x27;t. Trying out both is the best way to build up intuition for this kind of trade off.
评论 #31977244 未加载
评论 #31982892 未加载
评论 #31979249 未加载
评论 #31976928 未加载
andrewaylettalmost 3 years ago
&quot;Yes&quot;<p>I personally find that even spending a little bit of time in a programming language with a different paradigm is incredibly helpful. So I&#x27;d suggest that Go is probably too similar to be maximally helpful, Rust is really good, but something like Haskell might give your brain a better workout even if you never actually use it for anything concrete.<p>If your priority is to get things done, do them in TypeScript unless you&#x27;ve a <i>really</i> good reason to learn another ecosystem at the same time. If your priority is to learn and get better at programming in general, digging into pretty much anything else will help. Just don&#x27;t necessarily expect to get anything done.
评论 #31976934 未加载
mardixalmost 3 years ago
I have a Python and TypeScript background, and I worked with them on a daily basis as a web developer.<p>Rust will be more familiar and easy on the eyes, as the syntax and concepts are close to friendlier languages.<p>I just started to get into Rust as well, and so far I&#x27;m loving it.<p>Here are some resources to help throughout the journey:<p><a href="https:&#x2F;&#x2F;fasterthanli.me&#x2F;articles&#x2F;a-half-hour-to-learn-rust" rel="nofollow">https:&#x2F;&#x2F;fasterthanli.me&#x2F;articles&#x2F;a-half-hour-to-learn-rust</a><p><a href="https:&#x2F;&#x2F;stevedonovan.github.io&#x2F;rust-gentle-intro&#x2F;readme.html" rel="nofollow">https:&#x2F;&#x2F;stevedonovan.github.io&#x2F;rust-gentle-intro&#x2F;readme.html</a><p><a href="https:&#x2F;&#x2F;learning-rust.github.io&#x2F;docs&#x2F;a1.why_rust.html" rel="nofollow">https:&#x2F;&#x2F;learning-rust.github.io&#x2F;docs&#x2F;a1.why_rust.html</a><p>And for Youtube: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;c&#x2F;LetsGetRusty" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;c&#x2F;LetsGetRusty</a><p>Good luck and have fun!
评论 #31979088 未加载
评论 #31979028 未加载
xanatharalmost 3 years ago
What a missed opportunity to title it &quot;Should I Rust Or Should I Go?&quot;.
评论 #31976680 未加载
评论 #31978369 未加载
t-3almost 3 years ago
Reading the Go spec will only take an hour or two if you don&#x27;t get distracted. If wasting time is your concern, it&#x27;s such a small amount that you&#x27;ve probably recently wasted more time on a number of trivial things. Reading the Rust Book takes a bit longer, but it&#x27;s still just a handful of hours.<p><a href="https:&#x2F;&#x2F;go.dev&#x2F;ref&#x2F;spec" rel="nofollow">https:&#x2F;&#x2F;go.dev&#x2F;ref&#x2F;spec</a> <a href="https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;book&#x2F;" rel="nofollow">https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;book&#x2F;</a>
评论 #31976754 未加载
评论 #31976636 未加载
评论 #31976689 未加载
评论 #31976613 未加载
dceddiaalmost 3 years ago
I’ve been doing mainly JS and TS the last few years and picked up Rust because I wanted to build a video editor. It worked out, the product is launched (used Tauri which is also nice) and I’d choose Rust again, even despite the initial pain.<p>The basics weren’t too hard, but I definitely felt the learning curve! I used C and C++ professionally my first few years out of school, and in some senses Rust felt like coming home - thinking about memory again, references vs values, the short naming conventions… but in other ways (lol borrowing) it was a very different thing. Rust was the first language I learned in recent years where I couldn’t just cobble things together once I knew the basic syntax. The ownership system was at the heart of that, and I kept doing things that went against the grain and made the compiler unhappy.<p>Having come out the other side though, I’m really happy with Rust. It’s fast, and the safety aspect is awesome because I can be pretty sure that as long as I avoid .unwrap()ing things, the program isn’t going to crash. There’s none of the “null or undefined” anxiety like with JS.<p>It’s also interesting to see the difference in the communities. I really like how performance is a first-class citizen in Rust! A lot of libraries have benchmarks. People go out of their way to avoid allocating memory. Maybe overkill in some spots for sure, but it’s a stark contrast to the JS world where I often get the sense that talking about performance will attract cries of “premature optimization!”<p>For learning I used the official Rust Book initially, then Programming Rust (the O’Reilly one) to get another explanation of some things, and then Rust for Rustaceans - which was great but way over my head at the time and I should probably revisit it again.<p>I would say learning Rust needs a very hands-on approach. It wasn’t, at least for me, the kind of language where I could read a book and then go write Rust. It took practice and failure and mental shifts that I don’t think would’ve happened if I was reading or watching videos.<p>Good luck with whatever you choose and happy 4th!
评论 #31979673 未加载
anotherhuealmost 3 years ago
IMO it&#x27;s short term enablement versus long term.<p>You will feel productive early on in Go, but it plateaus. Rust has a lot more CS concepts and I think will be the more fruitful learning experience.<p>Also, Rust can lead you to WASM, which might work well with your web background.
评论 #31976745 未加载
评论 #31976694 未加载
评论 #31976692 未加载
yakubinalmost 3 years ago
If you want to build web services, I&#x27;d go with Go. It has an http library in its standard library. It generally has a bigger standard library. Rust has a bigger stdlib than say C++, but it&#x27;s still pretty anemic by the standards of modern languages. Go also compiles a lot faster than Rust, which is a major point.<p>If you like functional programming, or want to write embedded software, or high-performance software, I&#x27;d go with Rust. All those things are a lot easier in Rust.<p>Personally, I use Go for scripting and Rust for big projects, because Go compiles fast enough, has a nicer stdlib and dependency management than Python; while for big project my natural tendency to think functionally would make it too annoying having to translate simple concepts into programs twice as long as they need to be, expressing what they&#x27;re doing very indirectly. But I don&#x27;t write web services, so that&#x27;s a different story.
评论 #31988671 未加载
throwawaymathsalmost 3 years ago
Learn elixir. The way you program elixir will push you towards better coding. There&#x27;s a good chance you&#x27;ll get better at testing, better at writing documentation. If you stick around long enough, you will learn about distributed systems (and their failure and recovery modes) and failure domain management -- this stuff is built into the stdlib
评论 #31978789 未加载
评论 #31976713 未加载
sondr3almost 3 years ago
I&#x27;ve used both for a couple of projects, but my primary language of choice for most things nowadays is Rust so this will be a bit biased. However, Go is a fun language to use, it is incredibly easy to get up and running, it provides most of the tooling you need in a language (formatting, testing, linting etc) and compiles very fast (especially compared to Rust). It is a simpler language than Rust, and is missing a fair bit of more advanced features that other new languages has. Coming from TypeScript, I suspect Go will feel like a simpler version of it, the generic programming and type level magic you can do in TypeScript is far more advanced than the generics that Go (finally) has.<p>Comparing this to Rust however is a different ball game, where Go is straight forward and fairly easy to use, with Rust it can feel like the compiler is your enemy. Learning how the borrow checker works, why there are a whole bunch of string types, how mutability and references work when passing them around and so on is a serious undertaking. But once you get somewhat comfortable with it Rust is great. The compiler will guide you along with very helpful error messages, you can use pattern matching, traits and a advanced type system to your advantage to build very performant and easy to maintain programs.<p>In terms of getting &quot;to the next level&quot;, I would highly recommend trying out Rust. Go is not a language that will challenge you the same way learning Rust will, the concepts and patterns from other languages map over fairly well to it (though the concurrency story in Go is really cool, definitely give it a good look!) whereas Rust will be more foreign.<p>I had used Rust for a few years when I worked on a couple of programs written in Go and it took me a week or two before I felt mostly comfortable with it. With Rust however it took me a few months to stop getting compiler errors every time I saved, and a few more months to internalize why the borrow checker complains. But working on the projects using Go felt like a downgrade from Rust, I gotta be honest. So many times I sat there thinking about how features from Rust would&#x27;ve made things so much neater... though now I feel the same with Haskell and Rust.
评论 #31979826 未加载
pizza234almost 3 years ago
I&#x27;ve gone this path, and it ultimately depends on your goal.<p>If you want to broaden your skill set for your personal enjoyment, both are options, although &quot;enjoying&quot; learning Rust has a slightly masochistic trait ;)<p>I believe Rust is more of a calling, in the sense that it requires a unique motivation - it really is _so_ hard, especially coming from dynamic&#x2F;high level languages - and those who want to go through this, kinda know it already. But of course, that doesn&#x27;t mean that it&#x27;s for an elite only.<p>In a professional context though, Rust is hardly a productive choice. It has a very narrow market share. You can throw the stats out of the window; they don&#x27;t match reality; reality is that lots of Rust work is in crypto, and that positions at Big techs seem to be filled internally. In short: you&#x27;ll find very few available and appealing positions.<p>The good side is that Rust is sort of in its infancy, so there are fun communities to be part of.<p>Go... is simply the conservatively good choice. It&#x27;s easy, and it&#x27;s everywhere, and it&#x27;s still a good step towards systems programming (independently of it being classifiable as systems programming language or not), if that&#x27;s a direction you find desirable.
Barreraalmost 3 years ago
&gt; I’d like to learn whichever language will make me a “better” coder in the long term.<p>Since the goal is to learn rather than to get stuff done, I suspect Rust will give you far more bang for the buck.<p>If you&#x27;re arrived at TypeScript voluntarily as an alternative to JS, Rust&#x27;s type system will teach you a lot about types. You&#x27;ll also be able to take advantage of a lot of what you already know.<p>Rust will teach you more than you thought there was to know about memory. Unless you&#x27;ve worked with a manual memory management language before, this will be a big eye-opener regardless of where you go with Rust in the future.<p>But I suspect you&#x27;ll be most surprised by how approachable Rust is. It feels like a much higher-level language than its reputation might hint at. The single reason for Rust&#x27;s difficult reputation is the &quot;ownership model.&quot; If you own that and commit to figuring it out and practicing what you&#x27;ve learned, Rust will open up much more easily to you. That said, you can figure out a lot about Rust without ever using ownership.
karpierzalmost 3 years ago
I&#x27;ve been learning Rust for the past few weeks and have been enjoying it a lot.<p>- The community is very helpful on Discord (<a href="https:&#x2F;&#x2F;discord.com&#x2F;invite&#x2F;rust-lang-community" rel="nofollow">https:&#x2F;&#x2F;discord.com&#x2F;invite&#x2F;rust-lang-community</a>).<p>- The package ecosystem (crates.io) makes it very easy to find and import things, and they&#x27;re consistently documented.<p>- There&#x27;s a path to compiling on web via WebAssembly (<a href="https:&#x2F;&#x2F;rustwasm.github.io&#x2F;wasm-pack&#x2F;" rel="nofollow">https:&#x2F;&#x2F;rustwasm.github.io&#x2F;wasm-pack&#x2F;</a>)<p>In a few weeks of learning the language, I managed to put together this visualization: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;admiralakk&#x2F;status&#x2F;1542560489091350529" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;admiralakk&#x2F;status&#x2F;1542560489091350529</a><p>But realistically, either Go or Rust will be fine. You should pick the one you&#x27;re more likely to stick with and learn, even when it gets tough. I&#x27;ve found the community aspect to be very helpful, because then at least I know I&#x27;m not the only idiot out there.
mudrockbestgirlalmost 3 years ago
I think you have the right idea already, so it just depends on what you want. I believe that learning Rust has made me a better programmer because I am now explicitly thinking about ownership rules and references no matter what language I&#x27;m using. Types and memory allocation are also more explicit in Rust than in Go, adding to learning aspect. I don&#x27;t think learning Go has made me a better programmer. It was just another pretty standard language. But I already knew a range of other compiled languages previously and Go wasn&#x27;t sufficiently different.<p>Like you said, for &quot;getting things done&quot; that is not low-level, systems, or game programming, Go is the more reasonable choice. It&#x27;s more straightforward, faster to iterate in, usually more concise, has easy concurrency primitives, and is more widely adopted in the industry.<p>TLDR; I&#x27;d go for Rust if you want to optimize for learning and Go otherwise.
spionalmost 3 years ago
If you&#x27;re looking to get into the k8s space Go would be the way to... go.<p>Purely as a language, Go is worse than TypeScript by a lot (yes, even with generics), yet has a really well made standard library that more than makes up for it in many regards, and tooling thats similarly much better and pleasant to work with.<p>If you&#x27;re looking to learn more about systems programming as well as a bunch of advanced PL features that make development a joy, go for Rust. Besides being an excellent language, the library ecosystem and tooling are really well made as well (great documentation culture, tools work predictably and cover both simple and complex &#x2F; larger use cases e.g. monorepos, etc.)<p>I&#x27;ve decided to learn Rust. I had some small amount of hobbyist C++ development experience before, and the learning curve isn&#x27;t as bad as it looks, and its definitely better than something like Haskell due to the excellent documentation resources. It took a couple of weeks, about 1h-2h per day to get past the initial &quot;wall-like&quot; learning curve for borrowing and ownership (its important to preserve during this period)<p>I&#x27;ve refused to get into Golang as a matter of principle for a long time. I saw the language as a step backwards that deliberately ignores a lot of things we&#x27;ve learned in the past few decades in the name of &quot;simplicity&quot;. While I acknowledge that the ecosystem as a whole is powerful, I&#x27;d like a tool that doesn&#x27;t deliberately limit me without giving anything in return (lack of algebraic data types means reduced safety and more bugs due to inability to make illegal states unrepresentable, for example), all while trying to paint that as some kind of benefit. However, I reserve the right to change my mind if the right opportunities present themselves (also, given that they fixed generics, once error handling is made closer to Rust&#x2F;Swift I&#x27;ll be hapy to give it another... go)<p>I think Rust has a bright future in the JS ecosystem as its already growing as both the underlying-platform-language of choice (Deno), the main compile-to-WASM language as well as the lower-level tooling language (SWC, Turborepo server, Parcel components etc). In the last space Go is also popular but I predict ultimately Rust will win because of the other factors.
adrianNalmost 3 years ago
Hot take: Learning languages doesn&#x27;t make you a better programmer. Solving real world problems makes you a better programmer. Whether you do that in Rust, Go, or Shellscript is a lot less important. Perhaps find a book or a series of talks about a topic you&#x27;ve struggled with in the past, say, maintainability, and see how you could do better in that area. Or learn more about the domain of your customers so that you understand their requirements better.
评论 #31976845 未加载
评论 #31982930 未加载
karmakazealmost 3 years ago
Here&#x27;s a different take on the question based on my own experience. I learned Go from the online &quot;Tour of Go&quot;[0]. It was easy to read and learn with the interactive presentation. I came from a C&#x2F;C++&#x2F;Java background so the interesting things were all around concurrency (goroutines&#x2F;channels), value types and struct layout, and the use of structural vs nominal interfaces. I&#x27;m glad I learned Go and use it for many small personal projects and on occasion at my day job.<p>I&#x27;ve dabbled with lots of different programming languages&#x2F;paradigms to learn what&#x27;s out there that I haven&#x27;t been exposed to. A sweet spot of my interests is around F# or OCaml. Pony looks like an ultimate language of a sort that includes Rust and Clean. I&#x27;ve also wanted to have a reason to learn and use Rust. Much like I appreciate static typing, I could immediately appreciate Rust&#x27;s different reference semantics to make safe and correct concurrent software with higher performance than is possible with Go.<p>But this is where I have to decide where to spend my time. I have a vague idea of the strong areas of Rust. I don&#x27;t currently work in areas where those are prominent needs. I could justify it for any kind of low-level project I could come up with. Until I have that itch, it&#x27;s on the back-burner as I don&#x27;t consider learning Rust for the sake of learning Rust and its reference rules a big benefit to me. I can still spend most of my available time getting better at conceptualizing, shaping, and implementing monolithic APIs and distributed systems which isn&#x27;t exactly tied to a particular language.<p>[0] <a href="https:&#x2F;&#x2F;go.dev&#x2F;tour&#x2F;welcome&#x2F;1" rel="nofollow">https:&#x2F;&#x2F;go.dev&#x2F;tour&#x2F;welcome&#x2F;1</a>
LecroJSalmost 3 years ago
Adding for context: I don’t have a degree&#x2F;background in CS. I majored in Math back in college and learned Python followed by a js bootcamp. I’m now years beyond that and have developed what I’d deem is enough of an understanding of CS fundamentals to the point that I can comfortably speak about&#x2F;implement most things in the leetcode&#x2F;technical interview space.<p>My college didn’t have cs and I definitely feel like I missed out on learning about some really interesting things and now have an understanding that can only go so deep across the stack.<p>Based on this, let me know if you think rust is the better choice, or if you have any other thoughts as to how might be good to spend my time e.g. maybe I’m just in the wrong space entirely and should be reading a book on Postgres… I love learning new stuff, but I sometimes find that I don’t invest my time in the wisest thing at a given moment. After thinking on the replies, I am now supplementing this post with a request for whatever you think would help someone like me
评论 #31977416 未加载
cyneoxalmost 3 years ago
Speaking for myself: For someone who didn&#x27;t have a software engineering background (for the last decade I was mainly doing offensive Security stuff) probably the main choice would be Python. However, at some point I&#x27;ve felt in love with statically typed languages: The compiler became my biggest friend and I learned about the benefits of having &quot;contracts&quot; (in form of interfaces, strict parameter types for methods etc.) between (software) components.<p>That&#x27;s why I&#x27;ve spent the last years learning Go. It taught me how to design bigger projects and how to tackle architectural problems in an easy&#x2F;comprehensive way. I didn&#x27;t try Rust yet because I didn&#x27;t have to. I mainly code software&#x2F;tools to work in cloud environments and HTTP&#x2F;gRPC technologies. Under these circumstances Golang performs quite well.<p>For me it&#x27;s true that Go &quot;is better for getting things done&quot;: You&#x27;ll get one statically linked binary that can be executed almost everywhere (without further dependencies). I&#x27;m a big fan of serverless and I wrote simple applications that currently run in AWS Lambda and Netlify (they also used Lambda under the hood). And more recently I got into web development where Golang is again my main choice (at least for the backend part). For frontend I would rather go for VueJS&#x2F;React. And that&#x27;s one reason why I&#x27;ve started to learn TypeScript.<p>I don&#x27;t have that much experience in TS but I guess I could easily replace Golang by TS to do simple things (HTTP requests, JSON parsing etc.), especially in a Serverless environment.<p>While my Golang journey was accompanied by this &quot;Golang vs Rust&quot; debate, I do plan to learn Rust as well. But as I&#x27;ve mentioned before, currently I don&#x27;t have any needs to do so. My advice would be: Learn both (for backend) and some TypeScript (for frontend).<p>Just my 2 cents...
评论 #31989188 未加载
sys_64738almost 3 years ago
Rust will be in the kernel shortly so it&#x27;ll have longevity with that. Not that I&#x27;m saying GO won&#x27;t but kernel inclusion suggest permanent support.
garrenalmost 3 years ago
If your goal is to become a &quot;better&quot; coder, doubling down on understanding the fundamentals rather than the specifics of a given language seems like an approach to consider.<p>That said, others here have recommended C instead or in addition to Rust or Go; this makes sense to me.<p>C is actively used and remains the lingua franca of low&#x2F;system level programs (for the time being.) I&#x27;d also say that its relatively simple syntax and closeness to the underlying representation have a lot going for it (at least what you&#x27;d imagine the underlying assembly representation to be - hardware and clever compilers are doing a lot.)<p>The C language is simple, more than either Rust or Go, and can be picked up quickly, in my view. But actually understanding and using it competently is an altogether different matter.<p>Additionally, an absolute wealth of books introducing OS, drivers, and system and network programming topics using C exist. Projects like Xv6, Minix, and even Linux provide for code bases to run through and explore<p>- Computer Systems: A Programmer&#x27;s Perspective [0]<p>- The Linux Programming Interface [1]<p>- Advanced Programming in the UNIX Environment [2]<p>- Dive into Systems [3]<p>And the list goes on and on.<p>You&#x27;ll likely never write production code or push production projects in C (one hopes), but it seems to me that it remains a very useful language to be able to work with and to understand.<p>[0] <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Computer-Systems-Programmers-Perspective-3rd&#x2F;dp&#x2F;013409266X" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Computer-Systems-Programmers-Perspect...</a><p>[1] <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Linux-Programming-Interface-System-Handbook&#x2F;dp&#x2F;1593272200&#x2F;ref=sr_1_1?keywords=the+linux+programming+interface&amp;qid=1656955811&amp;s=books&amp;sprefix=the+linux+pro%2Cstripbooks%2C184&amp;sr=1-1" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Linux-Programming-Interface-System-Ha...</a><p>[2] <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Programming-Environment-Addison-Wesley-Professional-Computing&#x2F;dp&#x2F;0321525949&#x2F;ref=sr_1_3?keywords=advanced+programming+in+the+unix+environment%2C+2nd+edition&amp;qid=1656955855&amp;s=books&amp;sprefix=advanced+progra%2Cstripbooks%2C140&amp;sr=1-3" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Programming-Environment-Addison-Wesle...</a><p>[3] <a href="https:&#x2F;&#x2F;diveintosystems.org" rel="nofollow">https:&#x2F;&#x2F;diveintosystems.org</a>
crabbygrabbyalmost 3 years ago
Learn both. Go takes about 10minutes to write code in, a week to figure out harder stuff. Rust takes a few weeks. Both are good to know and fun to learn
blubalmost 3 years ago
I agree with the other poster saying that learning programming languages doesn’t make you a better coder, just as learning natural languages doesn’t make you a better communicator.<p>It’s much more efficient to pick a flexible programming language which allows using various concepts (functional, OO, etc) and constructs and then apply it in various domains which exercise those concepts&#x2F;constructs.<p>Coding can also be learned. Code complete (2nd) is one of the few books focusing on this area - the author calls it construction - and goes into detail about building functions, parameter passing and so on and so forth.<p>Another interesting book I read was Martin Reddy’s - API design for C++. You could try finding something similar for your chosen language.<p>Finally there’s a couple of books by Pete Goodliffe which are language-independent: Code Craft and Becoming a Better Programmer. Naming, comments, error handling - there’s tons of stuff in there.<p>Now onto the topic of Rust and Go - I’ve recently learned both and am about average skills-wise. Go’s easy (the book Efficient Go covers it) and has many sweet spots like network, cmdline tools, heavy concurrency services. Rust is complicated but you can see that it’s a heavy duty language that you can use almost everywhere. Neither made me a better programmer, because I was familiar with most of the concepts they provided. And the new stuff doesn’t improve ones skills, it’s just tooling.
评论 #31980472 未加载
dmytrishalmost 3 years ago
Disclaimer: I have no TypeScript experience. I&#x27;d say poking at both languages is useful. The choice of ecosystem can come later, according to the taste and tasks.<p>Rust:<p>- makes you a better coder indeed, Rust is pretty clear and organized about its abstractions. Sum types, honest traits, no nil values, disciplined approach to errors and generics, the right amount of niceties and syntax sugar. The idea of borrow checking (and when to avoid it) is a valuable insight into programming in itself. Straightforward RAII instead of wanton `defer`s everywhere.<p>- fearless concurrency (no global mutable variables, Arc, Send + Sync, ownership of objects by threads) with reliability heads and shoulders higher than everything else.<p>- first-class support for WebAssembly (wasm-bindgen, js-sys, wasm-pack, etc). Interfaces with other languages well (PyO3, Node bindings, C&#x2F;C++ via bindgen&#x2F;cbindgen).<p>- fine-grained, low-level control over memory allocations and layouts.<p>- requires quite a bit of effort and dedication to use it effectively. The standard library is extensive in volume (not functionality), takes time to learn, has its own conventions and context-dependent, non-straightforward idioms.<p>Golang:<p>- a language to get things done, with very decent and extensive ecosystem.<p>- a perfect choice for backend servers, microservices, everything working over the network.<p>- teaches about perils of freely mixing shared memory with concurrency. Goroutines are so easy to spawn, until they are not. Channels seem like a good idea, until dive into a real code base with mutexes and shared memory. Still, both goroutines and channels are solid, practical tools that work well.<p>- writing new code is objectively faster and easier with GC.<p>- compared to TypeScript, still teaches to manage memory layouts and has structs as values.<p>- doing pretty basic things like iterators, sum types, custom data structures, even tuples of values can be painful, but this is changing with the newly introduced generics.<p>- I still try to come to terms with the wild abuse of programming language theory terms in Go, where an &quot;interface&quot; is not just a trait, but also a set of types and behaves almost like a supertype.
praptakalmost 3 years ago
Depends on what do you mean by being a better coder. My take on what you can gain from learning each of these languages:<p>Go - concurrency with channels (that&#x27;s a big one, gives you a good tool to think about concurrency even outside Go), appreciation of language minimalism<p>Rust - what it takes to have memory safety without garbage collector<p>Speaking of mental tools for dealing with concurrency I recommend looking at Clojure with its concurrency based on software transactional memory and immutability.
pantulisalmost 3 years ago
Good recommendations in the thread.<p>I would ask myself: what would I expect to be building with Go or Rust? Of course, you can build anything with Go or Rust --or any turing-complete programming language for that matter. But *I believe* Rust programmers will be working mostly on foundational software --think caches, databases, compilers... while Go developers will mostly work building microservices and related tooling, stuff a little more business oriented.
tekbogalmost 3 years ago
I recently had to look into Go for an interview and the question you just made it&#x27;s on a lot of people&#x27;s minds however I&#x27;d say Go and Rust have different user cases so the answer, like always, it depends.<p>I&#x27;m unfamiliar with Rust, so I&#x27;m mostly going to address the little I know about Go. It&#x27;s a great language if you want low memory consumption, concurrency and a fairly simple codebase - the language is minimalistic and C-like so it tries to shove complexity away. I&#x27;m someone who hasn&#x27;t touched anything with pointers in ages and really loved it. Docker, Kubernetes, Terraform and from what I&#x27;ve heard a lot of Google services are being developed in Go, think about what they have in common and if you have a similar use case or you specialize in backend and devops then GO for it.<p>However people are reporting that Rust is coming to the Linux kernel soon so it seems like a solid choice no matter what you pick.<p>I think I have a similar background to you and learning Go definitely made me a better programmer and it barely took any time.<p>(Self promotion ahead, skip to last paragraph) I even made an article[1] that&#x27;s an introduction to Go where I talk about everything that seemed interesting to me and I follow up with a small project, it&#x27;s meant for junior to mid level developers that want to start with Go or are undecided. Perhaps have a quick look (it&#x27;s been well received and featured in Hashnode).<p>Overall I&#x27;d highly recommend learning Go, it was a breath of fresh air for me after working mostly with Node and Spring Boot. If I had to make a backend system, depending on the requirements, Go would definitely be a top choice for me.<p>---<p>[1]<a href="https:&#x2F;&#x2F;bognov.tech&#x2F;introduction-to-golang-build-a-mini-twitter-clone" rel="nofollow">https:&#x2F;&#x2F;bognov.tech&#x2F;introduction-to-golang-build-a-mini-twit...</a>
taylodlalmost 3 years ago
Given where you are now I&#x27;d learn Go. Go is a language born from the cloud. It solves modern-day problems featuring several networked machines with each having several processors. It&#x27;s probably going to be the most useful language to you because it allows you to build systems solutions spanning several networked machines. Go is also an easier language to come up to speed with than Rust.<p>I see Rust as a replacement for C&#x2F;C++. It&#x27;s for system programming on a single machine. Its claim to fame is having memory safety - it&#x27;s a <i>modern</i> language. If you&#x27;re wanting to build a more traditional app running on a single machine - use Rust.
jpcapdevilaalmost 3 years ago
I write JS 99.9% of the time.<p>I would definitely pick Rust as it is more different than JS.<p>Yes, there is a higher learning curve. But it will broaden your perception on programming languages.<p>As an added bonus, rust is very popular to create WASM stuff. So you can apply it to the JS world.<p>Happy 4th
rowanG077almost 3 years ago
If it&#x27;s for learning choose Rust. Go has not much to teach you since it&#x27;s such a basic language. Actually I would also choose Rust for getting things done. It just takes longer to master.
kaba0almost 3 years ago
Why are these two languages chosen? I would suggest thinking of a niche you want to fulfill - you mentioned web servers, for that use case Go is fair, but do note that Go is a managed language much closer to JS than to Rust. There is probably not even that many new concepts in Go compared to TS (both use the otherwise rare structural typing).<p>If you want to instead learn about low-level programming, Rust is a great choice, but so is C for some basic concepts.
rr808almost 3 years ago
I think if you&#x27;re in the front end world and likely to do more full stack work go is perfect for this, so its likely to lead to jobs in the next year or so.<p>Rust I like it but worry it hasn&#x27;t really taken off as I expected. C++ seems resurgent. The C++ world is vast, perhaps you&#x27;ll learn more with that and the skills will be more useful. Either C++ or Rust dont get used in full stack though so it really is a different world.
SaulJLHalmost 3 years ago
Something that I&#x27;m very much interested in, too!<p>Tangential &amp; important&#x2F;useful to this question is:<p>&quot;Ask HN: Great visual or other breakdowns of PL&#x27;s &amp; their categories&#x2F;sub-c&#x27;s?&quot;<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31919255" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31919255</a><p>Posted over 5 days ago, sadly, there was zero responses.<p>Should I try reposting from scratch, or 1st w&amp;s if this <i>bump</i> sparks things?<p>Ty
KingOfCodersalmost 3 years ago
More Rust than Go experience. Both aren&#x27;t perfect to me. I fight the borrow checker too much in Rust and everyone tells me to use Arc&lt;&gt; which is ugly. Go has a nice GC. Rust is a richer language than Go, Go is much simplier. Rust has a much nicer build system (rustup, cargo, ...). Go is fantastically fast when compiling. Go has currently the best async execution runtime with IO parking.
keylealmost 3 years ago
&gt; I’d like to learn whichever language will make me a “better” coder in the long term.<p>Install every compilers available under the sun and learn the bases of every language. Then dig deeper in each in what is idiomatic and why.<p>From prolog, to arc, don&#x27;t limit yourself to the mainstream languages. You won&#x27;t be able to eventually avoid them anyway. Some day, Java happens.
fithisuxalmost 3 years ago
If you look to glue systems and add some new code at system level (not confuse it with OS level), the Golang is a better option. E.g. microservices, talk to databases, implement some distributed algorithm in your code.<p>Now if you plan to do number crunching, low level algorithm or scientific computing, Rust by all means. Unless you glue algos, then Python or Julia
PhantomBKBalmost 3 years ago
Learn Crystal <a href="https:&#x2F;&#x2F;crystal-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;crystal-lang.org&#x2F;</a>
Saphyelalmost 3 years ago
If you want to improve your code skills I think Rust is the best way and also you could help to the linux kernel now ^^<p>If you are looking to do async apps I&#x27;d recommend avoid Rust in the short term (the ecosystem about async in Rust is a mess at the moment, hopefully in a few years is in a better position and probably in the core)
schmealmost 3 years ago
I&#x27;d go with C first. Rust would teach you everything C does and more, but C will lay the foundation in cleaner strokes. This will help you later no matter what language you decide to learn next. C is also in a way the language of the FFI, so you are very likely to need it in the future regardless.
评论 #31977100 未加载
holografixalmost 3 years ago
Learn go. It’s much more widely adopted with very significant open source projects written with it.<p>You will become productive very quickly and it will help you make better use of multi core processors.<p>Go just introduced generics which was holding back quite a few people from trying it. Now it’s the time.
PragmaticPulpalmost 3 years ago
I personally enjoy Rust more than Go, but if you’re considering the career angle then Go has a huge advantage of more jobs.<p>Rust has a steep learning curve, like you said, which is one reason why it won’t be nearly as common as Go in the workplace.
bradhealmost 3 years ago
Learn both. Go in particular is quite simple. Rust will take a bit more time.
DethNinjaalmost 3 years ago
Why no start with C? Then perhaps check C++ and Rust?<p>If you want to understand internals of programming languages then Go isn’t a great choice because it abstracts away so much stuff.
评论 #31976718 未加载
评论 #31976715 未加载
dborehamalmost 3 years ago
Either or both would be fine. They&#x27;re both &quot;proper&quot; programming languages today. golang is the F-150 pickup truck of languages, while Rust is more on the V10 Lamborghini end of the spectrum. More difficult to work with, life is more exciting.<p>golang has essentially no nonsense in it (due to guardianship by crusty old men at Google). No async ever happening there, thankfully.<p>Rust, lacking a single corporate backer, has more evolutionary churn and a bit less pure focus of vision imho (concurrency implementation changed several times, it now does have async even though there&#x27;s no need for it).
nunezalmost 3 years ago
start with go for employment opportunities then learn rust. if employment isn&#x27;t a driving concern here, both are great languages.
BobbyJoalmost 3 years ago
Doing a few projects in Go will make you a better programmer in general, a it forces you to write simpler, more comprehendible code.
akagusualmost 3 years ago
I think it depends on your goals.<p>Do you want a job in the short-term? Choose Go.<p>Do you want a job in the long-term? Choose Rust.
评论 #31977249 未加载
thinkpad13almost 3 years ago
for what type of application are rust and go used nowadays?<p>I know ruby has ruby on rails,<p>python has django, panda, torch, keras and tensorflow,<p>typescript&#x2F;javascript has vue and react and express and etc.
jrmsalmost 3 years ago
Try both and pick the one you like the most
chrisoverzeroalmost 3 years ago
Yes.
评论 #31980480 未加载
fiatjafalmost 3 years ago
Learn Scala.
Shadonototraalmost 3 years ago
This kind of question is the reason why you&#x27;ll never be good a good developer<p>&gt; I am a full stack TypeScript dev looking to broaden my skill set by learning a new language. I’ve been weighing Rust vs Go for a long time but can’t really decide which would be a better use of my time. I often hear that people who try one of these languages after coming from something like TypeScript feel that they really level up their abilities&#x2F;understanding.<p>I don&#x27;t know if that&#x27;s a joke or just misinformation
评论 #31980457 未加载