287 points · by pauldix · 8y ago · 274 comments
We've also found that the learning curve is, in our opinion, a bit overstated. We've ramped up several new grads on Rust with the O'Reilly Rust book. We see real productivity in about two weeks, which is actually faster than it was to ramp them up on our C++ code base. The compiler errors are amazing and it's almost like giving them a built in tutor.
I'm very bullish on Rust becoming the language of choice in the 2020s for everything from operating systems, web services, desktop applications, and more. It's that good.
C++ for example, is a hard language, but the learning curve is ... progressive (rise bit by bit).
Rust on the other hand, is like climbing a cliff: You're exposed to everything as soon as you start learning. That's all the Rust things (memory safety model and borrow etc) plus the rest of the knowledge that you need to learn when you normally learning a language (std library & stuff).
Luckily though, Rust did many thing in later years made it a little bit easier to use and learn. Like the rewritten books and manual and in my opinion most importantly few twists to the language.
My biggest (maybe nothing in the big picture) complain about Rust now is maybe it's too community driven, which can sometime cause minor fragmentation.
As a personal developer, if I've already followed every best practice writing my code, then to be honest, after the code is finished, I'm not willing to rewrite my code just to make it dated or work again (I mean, I'll pay my time to do it, but my hate meter will rise). Currently, Rust cannot fully deliver that.
I think Rust need strong leaders to layout a clear and stable plan, so more things can be standardized across it's ecosystem (Somewhat like what Go did, for example, io.Reader && io.Writer is life changing for me). In that way I can keep my hate meter at a safe level.
Look at the Future trait, as an example. And rust has had the equivalent of io.{Reader, Writer} since 1.0.
In Go, `error` is an interface that can later be asserted, so I can return any `error` then deal with them as late as I need.
This gives me ability to write some complex `io.Reader` and `io.Writer`. For example, an `io.Reader` that can Decode data stream, and returns both CodecError and IoError when it encountered any.
In Rust, if I want to write a similar thing, a HPACK decoder that returns both `io::Error` and `HPACK::DecodeError` for example, I need come up with another `Result` type that wraps both errors. This can sometime be tiring and makes the code inflexible (As one simple change to the `Result` may effect the entire call chain up and down).
BUT ... Maybe it's Go's fault, it treats me too well, make me want something that I cannot have for free (performance cost) else where.
Just to add my opinion, not to disagree: I followed the development of Rust for several years now (starting before 1.0). Rust's approach to language evolution is very much community-driven (like you said). But this also led to many really good ideas coming from people with different backgrounds. Today, Rust feels like a highly optimized breed of good ideas taken from many programming languages and I know of no other language that feels like that. Sure, every new language gets inspiration from older languages, but Rust appears to be more "extreme" than other languages (and I do not mean "extreme" in a negative sense). This was most visible in the pre-1.0 era. People had different ideas how the language should work and the Rust team tried different things and iterated on the things they learned. And I think this was totally worthwhile.
Let's talk about Python for a moment. I really like Python. It is a language with clear conventions and idioms. And most likely it achieved this state thanks to Guido van Rossum who had very clear ideas about what the language should be. And one of the core ideas is simplicity. Python (being inspired by ABC) was meant to be easy to learn (because of it's simplicity).
Now, let's go back to Rust. Rust also has clear ideas: "Rust is a systems language pursuing the trifecta: safety, concurrency, and speed" (Quoted from: This Week in Rust). And yes, "consistency" or "ease of learning" are not listed as the core ideas. However, when you look at the Rust roadmap for 2017 you will also see that the team has prioritized the following items:
* Rust should have a lower learning curve
* productivity (which includes easier usage of the language)
These issues are definitely on the radar of the Rust team. But I also think that these issues can only be tackled by an entire community which shares and discusses ideas. Rust tries to be much more than other languages and I think it is highly unlikely that a single leader will know how to direct the language in a specific direction. There are still a lot of things to be figured out. For example, let's see if the failure crate becomes the standard for error handling in Rust.
Rust on the other hand, is like climbing a cliff </quote>
c++11+ is a hill that is so freaking high that you do not see the top.. like Olympus Mons.
honestly i do not see much difference in learning c++ or rust - in order to write good programs you should know most of the c++ standard and that's a lot to absorb.
Except that you've always got a footgun in each hand, with no safeties and no trigger guards.
Rust keeps its footguns locked in the gun safe. You get them out with the `unsafe` keyword.
I don't mean to burst your bubble here. But people need to feel productive quickly with a language, otherwise they'll drop it and move to something else which makes them feel that way.
Looking at this thread there are plenty of examples of "I love Rust, but..." or "It's a great language once you get past...". My favorite: "There's an awesome web framework but you have to use Rust-nightly..."
Javascript is thought of as a terrible language by language snobs, and yet it has a huge following. Haskell, on the other hand, is much beloved, and doesn't. Don't get me wrong, it's got its share of love, but hasn't seen the explosive growth that python or java has.
The lesson from the early 2000's is that C++ may be a superior language to Java (I used to think that way), however people were so much more productive with Java. They didn't have to worry about memory management, segfaults, crazy C++ semantics, etc. Companies were more willing to throw hardware at a problem to reduce risk/time in development. And that is still true today.
You won't.
> But people need to feel productive quickly with a language, otherwise they'll drop it and move to something else which makes them feel that way.
This is relative. Rust is far easier to learn than C++. It has a compiler that will even enforce that you don't shoot yourself in the foot. It also has nice tooling to get you up and running quickly. It has good documentation. It has a free book. We've had no trouble getting our new grads up and running with Rust. It's not that hard.
> Javascript is thought of as a terrible language by language snobs, and yet it has a huge following.
Having a huge following doesn't make it less terrible by the measures of PL theory or sensibility. It's also the only choice on the web, but that may soon change, Rust has first class support for wasm so it's in a good spot there.
> Haskell, on the other hand, is much beloved, and doesn't. Don't get me wrong, it's got its share of love, but hasn't seen the explosive growth that python or java has.
By most accounts the Haskell ecosystem and user base are quite large considering it is intended as a research language, and the community is still growing. Rust isn't intended for research, and it's incredibly young compared to Java or Python, so it has plenty of time to catch up.
> but people were so much more productive with Java.
Hahaha. You mean people wrote a lot of Java. Let's please make the distinction between productivity and writing a bunch of enterprise crapware churned out by barrelful.
> They didn't have to worry about memory management, segfaults, crazy C++ semantics, etc.
That's exactly what Rust does for you.
> Companies were more willing to throw hardware at a problem to reduce risk/time in development. And that is still true today.
Actually companies are becoming more aware that speed is a feature, and that Moore's law isn't holding out. We're also moving to smaller form factors: phones, watches, glasses... the future is not on the desktop by any means, and no one wants to waste capacity in a datacenter needlessly.
> Actually companies are becoming more aware that speed is a feature
No. If that were true, Python wouldn't be the fastest growing language, and we'd be hand optimizing everything in assembly and using languages that allowed us to do that (C). That was the entire point I was making. It's why Java won.
I can't figure out if Rust is serious about being a true competitor, or just merely riding the peak on the Gartner Hype Cycle [1].
[1] https://www.gartner.com/en/research/methodologies/gartner-hy...
Rust is competing in the space of C and C++, it is not competing against Java or Python. People are not gong to write operating systems in Python because it feels more productive. For simpler desktop applications you may have a point, but heavyweights like Word or Photoshop are written in C++ and Rust may be a realistic migration. JavaScript or Python is not.
Especially we've gotten used to so many of C++ shortcomings that we don't see them, but someone learning both Rust and C++ will (I'm sure) have a better experience in Rust. Even just the built in tooling (Cargo test, Cargo crates, rustup, etc.) feels so much more mature than when you're in 2018 looking at how to compile some C++ without an IDE.
For Rust to win it must be adopted by Gaming or gaming engines.
Rust is really only competing with C/C++, not JavaScript or even Java (or Go).
Like C on embedded vs C++.
On Windows large majority of apps are in .NET with some C++.
On OS X and derived systems it is all about Objective-C and Swift for desktop apps. C++ is mostly used for drivers, LLVM tooling and Metal shaders.
Android is Java with some C++.
ChromeOS is all about JavaScript.
So no, C and C++ have lost the desktop, nowadays they are used for the graphics composition engine, while the remaining APIs are built on top of it with another set of languages.
If Rust is supposed to beat C and C++ on the desktop, it needs to be able to integrate into the IDE tooling alongside the mixed language tooling experience.
Does it? Existing project use what they have chosen long time ago, we can only discuss choice for new ones. And new OSes often choose something else. I am not aware of any new webbrowser, so can't say anything about that.
Yes, I agree, but that's not the full picture. People want a language in which they can be productive quickly, but once they master it, they, or at least some of them, will then look into quality and performance. Languages like JavaScript or Python (and even Go to some extent) are popular and easy to pick up, but there's not much room for further progress. JavaScript is already stretched to its absolute limits when it comes to performance and it's still not performing very well. And when it comes to quality, well, TypeScript is a thing for a reason.
I don't believe Rust will ever be as much of a language for the masses as JS, but it has a good chance to become a niche language for those who need or want more performance and/or quality than they can get with langs like JS or Python.
My biggest gripe is that they left out readability.
I like the semantics of Rust, and appreciate the performance and the transparent memory model. I am extremely excited to try Rust on an embedded project.
Bur honestly, the syntax is gruesome. Coming from Python, Rust looks like two rabid gerbils had a war dance on my keyboard.
What exactly is terrible about it? The snake_case I got used to, I kind of like having braces, and that's not really a killer argument either, because most languages have them, apart from that I find Rust also much cleaner than Python syntax. I'm really not sure what you mean. Is it the lifetime annotations (because they're somewhat necessary).
fn accumulate<'a, T: Monoid>(tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> T
where
T: From<&'a str> + From<String>,
this is JUST the function signatureyes, every single thing in there is necessary, it can be written in a more gruesome way, but the where clause clarifies it a bit
But let me cheat a little bit
( $(#[$attr:meta])* enum $enumer:ident { $($i:ident => $e:tt $( ( $($m:ident),* ) )* ; )* } ) => {
how is this macro syntax looking?Also, it makes autoindent in Emacs worse.
Here is the thing about indentation versus curly-braces-and-semi-colons: It boggles me that people find it acceptable to use one mechanism to communicate block structure to the compiler, and a completely different mechanism to communicate block structure to humans, and have no way to automatically check that they have the same semantics. This is a frequent source of bugs, and is entirely preventable. When it comes to the ergonomics of computer-convenient versus human-convenient, humans should win. Therefore, significant white space is clearly preferable simply from the standpoint of eliminating the source of an entire class of bugs.
But the main thing that makes Rust harder to read is all the punctuation noise and short, cryptic keywords. While one friend once said: "A good programmer can write FORTRAN in any language.", I don't feel compelled to help them.
Readability matters.
Python is ugly and inconsistent as hell due to lack of methods (no maps or reduce in collections for example), indentation, lack of expressions (nearly everything is a statement) and one statement lambdas.
Though rust is beyond good and evil indeed, I really don't get this obsession with brackets and C-like abominations like &*staff. Ada or SML are doing a much better job.
Autoindent is a solution to a problem that doesn't exist in Python in the first place. Having two independent representations for blocks, one for human readers (indent) and one for compilers (braces), leads to nasty bugs when they get out of sync. Autoindent is a tool to keep them in sync. In Python there is a single representation, so nothing can get out of sync.
> If I have to have another argument about tabs vs. spaces I am going to toss my monitor out the frickin’ window.
Clearly the correct answer is spaces. /s
Seriously though, I like python because not only is it pretty, it's also concise. While it's not perfect, a lot of time has been spent on language features to make them easily comprehendable.
The lesson for me from python is that UX is important, even in programming languages.
I think it's funny how people still have issues with this in 2018.
Languages like Java are more verbose which does make it a bit more frustrating to write but on the flip side I find them easier to read.
I ended up just using rails in api mode which is a shame because it chews up the limited memory on my server.
Most of these issues would go away if I was a rust pro and I could just write my own libraries and read the source but it really didn't feel like rust was helping me become productive fast like ruby did.
Rust crates should have documentation though. Rust has great tooling around writing docs in comments and generating the documentation from those. Rust is also statically typed, which makes it easier to reason about what a function does without the docs. In fact, lifetimes give you even more information about the relationship between inputs and outputs than a normal statically typed language.
Every app I've ever written that talks to postgres spends way more time...waiting on postgres than doing anything else.
It's like the joke about getting a faster processor so you're 99% idle instead of 95% idle.
I find Rust to be fairly easy to reason about. The compiler has awesome messages, and even links you to your error type with more information. I also HIGHLY recommend reading the O'Reilly book AND the official Rust book (the free one) if you feel like you're "just not getting it".
Rust is a language that rewards understanding, and stops you from making mistakes when you don't know how things are actually working. This is a revolutionary plus. At the end of the day, Rust's rules are what other languages enforce through convention and the school of hard knocks.
After all, is that not the point of computing? To have the computer check things for you that a human is prone to error on?
For sure. The Rust community takes the cake when it comes to owning criticism, wanting to make things better (as opposed to excusing issues), and self-organizing to affect change (e.g., the working groups). I like Go and its community is well above average, but it stands to learn from Rust's community IMHO.
> the meetups have been really positive. They even have the #rust-beginners channel. :)
I know, but a slack/irc/email/etc channel is a really poor substitute for having humans in a room who already have context about the problem you're trying to solve.
> I find Rust to be fairly easy to reason about. The compiler has awesome messages, and even links you to your error type with more information. I also HIGHLY recommend reading the O'Reilly book AND the official Rust book (the free one) if you feel like you're "just not getting it".
Hard to make heads or tails of this without knowing what you're comparing it to. I do agree that Rust does a fantastic job (via its error messages, documentation, books, etc) at addressing the hard problem of dealing with a compiler that pedantically enforces not-very-intuitive invariants, and I respect Rust for believing that those invariants are worth the trouble. I think they _are_ for lots of applications, but I think Rust needs to do quite a lot on the learnability/intuitability front before the economics justify using Rust for general purpose application development. For the time being, for most applications, it's just so much _cheaper_ to use something like Go in the general case.
Didn't ocaml already answer that question? Since ocaml hasn't dominated, it seems something more is required... What has rust got beyond that?
--https://en.wikipedia.org/wiki/OCaml
Rust has memory-safe concurrency without a GC.
The 'small, easy language for ignorant developers' niche certainly exists, but it's already taken by Go.
Rust currently provides no benefit over (modern) C++ for the problems where using Rust or C++ makes sense. (Though perhaps Rust will make it easier for layman developers to learn Rust and then transition to C++.)
I'm even more perplexed by "Rust currently provides no benefit over (modern) C++."
* Rust's "pthreads and mutexes" wrappers prevent data races at compile time, and there's Rayon to compete with things like OpenMP.
* Rust's moves are destructive, guaranteed nothrow, and also checked at compile time.
* Rust's borrow checker is light years ahead of C++'s.
* Rust's type system lends itself to far simpler generic code, with trait-based generics and sum types instead of concepts and std::variant.
* Rust's iterators are much better than C++'s, to the point that Ranges is one of the most highly-anticipated additions to C++.
All of these are things C++ is actively trying to improve, so clearly at least the committee agrees they're worthwhile features.
Rust has some nice features for handling ownership semantics, but they are not significantly better than those in C++.
Meanwhile, Rust still lacks a normal exception handling story. Exception handling is absolutely necessary in 2018 for building real software systems.
(And even though Rust claims that errors are nicely dichotomized into "recoverable" and "not recoverable" camps, this is simply not true in the real world. There are obvious counterexamples that don't fit into this dichotomy.)
Given that Rust doesn't actually solve any of the actual problems C++ programmers have, there is no motivation to switch.
- sending dangling references to thread functions. Lambdas with automatic reference capture creating threads from inside functions that exit are terrible here.
- returning a pointer or reference to an invalidated iterator
- returning a pointer or reference to the contents of a temporary
Yes indeed, C++ programmers never actually have these problems, they are purely imaginary. /sarc
It's the ugly side of Rust; when you're stuck with a series of problems that you can't solve (or take too long to solve), when there aren't enough people in the community to help you, and you end up being unproductive for a while.
Where I've seen small projects to their completion, Rust has been greatly rewarding to me. It's the projects that are bigger and more ambitious where I'm struggling.
> After reading the first 10 chapters of Programming Rust, I was able to push through the rest of the implementation. I still have open questions, and I’m not sure if the structure I used makes the most sense.
There's some chapters of TRPL and other resources that I've re-read a few times by now. Learning the language ends up being quite a lot of an academic exercise, but the benefit's that once a concept clicks, it paves way for many other concepts.
My only advice to less experienced programmers (whom you're not) learning Rust: Stay away from writing or rewriting time-critical applications in Rust if you can't tolerate being stuck on a problem or series thereof for weeks.
My point is that we very much align out expectations for the dominant paradigm and we got surprized when we have to actually "learn", i.e. internalize some different logic.
BTW, I started feel comfortable with Rust/Tokio/futures/etc. in less than a month. But I come from Scala/C++/logic and type theory background, that I guess is not so common.
With patience, I eventually solve many problems, but the lead-time is costly. Plus when I'm doing something wrong in my code, rustc could take over 5 minutes compiling, and then come back complaining. Even when I find someone willing to help me debug, the process takes a few hours, and I end up feeling bad for wasting someone's time.
This is a big difference when moving from Go. A language that nobody calls beautiful, but is very easy for a team to contribute to and support (relative to other languages).
The other kind of beauty is a quest for an abstraction that makes everything conceptually simple—once you understand the abstraction. It’s more of a mathematical elegance thing, and it’s just gravy if it happens to solve a real world problem.
First attempt with rust more than doubled performance of the existing system on the same hardware. Now I feel a need to learn more.
Rust is fine, rust is managing almost 2k/s on the same hardware. And this is when I know practically nothing about Rust, I expect I'm likely able to do better given time.
It's acting as a simple filter and cache over JSON data on Postgres.
Rocket's biggest feature is their flashy website, in my opinion. Their website is really nice looking and the self-assured marketing is convincing to readers.
Actix-Web seems like a more mature framework (I don't expect my application to randomly break), it's asynchronous (so it's really fast) and it works on stable Rust. Warp and Tower Web look like promising async frameworks, but they're not very mature yet. Rouille is a pretty stable option for a simple, synchronous web framework.
Regardless, Rust is stabilizing procedural macros which just leaves the never type as the last stabilization required for Rocket to be able to run on stable Rust. Additionally, I believe their next release is targeting the rewrite to async. A lot of it has to do with Rust firming up its own story around async.
For what it's worth, at least some of the largest rust adopters just pin to a nightly version, and don't have a ton of issues upgrading.
> it's asynchronous (so it's really fast)
Whether something is 'synchronous' or 'asynchronous' has absolutely no bearing on performance.
I've been following rust for a while and have known it is not web ready, but early next year I think will be a different story.
Rust has conquered a lot, but it’s web service/API story is not complete yet. Go is ahead in this respect.
Does my proclamation still seem disingenuous to you? If so, why?
IIRC h2 support has been in Hyper for a few months.
The curve to productivity seem way too steep for the payoff.
C++ is huge. It takes an incredible amount of effort to become a proficient C++ developer, and even then, C++ offers none of the amazing safety guarantees that Rust's borrow checker enforces. It's old language with sedimentary layers, including C backwards compatibility. Rust is no where near as complex, and Rust does 5x more to ensure you use Rust correctly. It has brought so many crucial advancements as well: immutable by default, typeclasses instead of OOP (thank god), real sum types, better unicode support, better concurrency primitives, and much much much better tooling and package management. No one in their right mind would be cracking out another C++ project if they took the time to learn Rust and C++.
Go isn't really in the same league as Rust, C++, or C. It's syntax is deceptively C like, and it has an equally poor type system, but it's performance is closer to Java, which is a few orders of magnitude slower than C++. Despite pushing outdated concepts like null and raw pointers on to the programmer, it has a runtime with a stop the world GC with no guarantees about object placement on the stack or heap. Go is also incredibly divisive, it's a step backwards that hardcodes a few useful container types, and gives you no facility to create your own. It has a hard coded method of concurrency (goroutines). While useful in it's simplicity, it lacks the generality one would expect of an industrial language, and these concerns are only now being accepted by the Go team in their 2.0 drafts. Many people believe that Go rose to popularity because of the authors and the company sponsoring it, not on its technical merits ,and Brad Fitzpatrick, one of the maintainers, even said the language brought nothing new to the table aside from better concurrency support in the Gotime podcast episode he attended.
I don't believe this to be the popular opinion. Originally Google's involvement dissuaded me, and indeed the very Googly bits have been the worst (context.Context), but the rest of it is markedly un-google-like. It's much more of a Bell Labs feel, with a focus on tool efficiency and stability.
> Brad Fitzpatrick, one of the maintainers, even said the language brought nothing new to the table aside from better concurrency support in the Gotime podcast episode he attended.
I think that was very much the intent. There were a lot of good ideas over the years (especially in Plan 9) and Go is really just a modern, polished revision of those ideas glued together.
Go is a _systems_ language at heart. It focuses on maintainability and literacy, and that's where it leads the pack in my eyes. It's possible to squeeze pretty phenomenal performance out of such a simple language. It's easy to drop into assembly for ultimate optimizations.
Perhaps generality is a mistake? I don't miss it. I've never found joy in debugging someone else's generalized metaprogramming.
Building software at serious scale has led me to appreciate the wisdom buried within Go. It's boring and I love it.
I've written a bit of Rust (and a lot of C++) which I find enjoyable enough, but they're tools I rarely find myself reaching for.
Plan 9 is an operating system. If you're referring to goroutines, CSP is completely unrelated to any of the work done at Bell Labs. That was Hoare. Go also kept a ton of terrible ideas, like nil, void (interface{}), and default mutability.
> Go is a _systems_ language at heart.
It really bothers me when people say this, because it's just untrue regurgitation from the Go team. It's not a systems language. It's a language that's pretty good for small web services. It has expensive interop (Solomon Hykes commented on this during one of his Gotime interviews) with C (even the Go team says cgo is not Go).
> It's easy to drop into assembly for ultimate optimizations.
You can only drop down into Plan 9 assembler, which is essentially useless. Write me an SGX lib without cgo in x86 and you can make that claim.
A few order of magnitude is an exaggeration. A more reasonable expectation is a 5x slowdown [1]. Depending on your task, a few orders of magnitude can be correct for JVM based languages; they can have very poor startup times (compared to c++) [2]. However, in startup time, go is not similar to Java.
[1]:https://benchmarksgame-team.pages.debian.net/benchmarksgame/... [2]:https://github.com/bdrung/startup-time
Hello world :-)
And is 54.55 ms perceptable?
(310.81 ms should be).
Man, stating your opinions as fact is one thing, but every other claim you made above is empirically incorrect. Rust is a fantastic language on its own merits; no need to make stuff up about “the competition”.
Go vs Java https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Go vs C++ https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
> pushing outdated concepts like null and raw pointers on to the programmer
I mean this is just a fact. Are you disputing nil and *?
> it has a runtime with a stop the world GC
https://blog.golang.org/ismmkeynote
"On the Y axis we have GC latency in milliseconds. On the X axis we have time. Each of the points is a stop the world pause time during that GC. "
> with no guarantees about object placement on the stack or heap
From the F.A.Q.
" How do I know whether a variable is allocated on the heap or the stack?
From a correctness standpoint, you don't need to know. Each variable in Go exists as long as there are references to it. The storage location chosen by the implementation is irrelevant to the semantics of the language."
> but every other claim you made above is empirically incorrect.
Seems you're empirically incorrect.
Yes, the point isn't to say that they are similar. Quite the contrary in fact, they are different enough that they compliment well. If I have to do latency sensitive systems work I would use C++17. It's good enough, has useful constructs, and all-in-all, rather easy to write.
It's nice to have stronger static safety but they usually displace the cost somewhere else. AFAIK, Rust becomes extremely touchy when you start inter-operating with abstractions the borrow-checker is not omniscient about. Wrapping code in unsafe{} everywhere feels clunky. That's not my biggest peeve though. Programming complex systems is an iterative process for me. I prototype, go back, throw it away, rewrite, until requirements are met and so on. I don't feel like I would be productive doing that in Rust. I don't care for safety for as long as the software prototype is complete enough. In that phase of development, what I care about is a compromise between velocity, performance, and safety.
The only thing I really miss in C++ is powerful type-system: GADTs and all. But again, if I find that I need those I would use a language that truly excels at that, OCaml.
For anything else, I found Golang to be a terrific fit.
It is easy to on-board new people and have them get productive and feel empowered enough to push change. The building blocks are easy and compose well.
Yes, I agree the lacks generics of generics can be frustrating, especially when software grows. On the other hand, it can get old really fast to debug templated software.
As for GC, it might not use fancy algorithms but from empirical experience, having worked with a wide-range of different applications with different workloads, I found that GC pauses are short and hardly ever an issue. I wouldn't use to write a RTOS but for most usage it's fine and a net positive in productivity and quality.
>Go rose to popularity because of the authors and the company sponsoring it, not on its technical merits
It rose to popularity because it fills a huge niche. My job is to build robust systems that do their job and deliver business value. It's easy to maintain Go code, it's easy to understand, and provides the right amount of static safety most of the time. I find Golang to be a humble and honest language, a productive C.
Rust is cool but not worth it for me.
>No one in their right mind would be cracking out another C++ project if they took the time to learn Rust and C++.
If I had a dollar every time I had read that (replace Rust by Haskell/Erlang/Lisp/Whatever language the cool hip kids use).
[1] https://adventofcode.com/2017/events (3 editions has been released so far)
Depending on the interface, this tends to exercise language and runtime features like: string handling and parsing, event handling, conditionals / pattern matching, etc. "Calculator" is also a big enough problem space that you can come back to it to try out more interesting language features (e.g. using Rust enums to model your calculator's operations).
This was a critical mistake for me when learning Rust and led to many, many stumbling blocks
But surely it's going to depend somewhat on the language and what things are easy/hard to do in that language?
1. Kotlin Koans (https://play.kotlinlang.org/koans/overview) 2. Ruby koans (http://rubykoans.com/)
Rosetta code also has a great selection of problems / solutions in various languages: http://rosettacode.org/wiki/Category:Programming_Tasks
However, I'm still torn between those languages, which I both consider as fancy alternatives to C++ with a growing amount of libraries and community support. I neither like Go nor Rust, but learn them to keep up to date and because I need something with good tooling and many libraries that creates compact and fast executables. Rust still seems overly complicated to me, though, and I say that as someone who enjoys programming in Ada.
lack of references, no generics, verbose error handling, a few quirks (e.g. need to write (*slice)[i]), inconsistencies like new vs. make, interface{} hacks where there could be a zero-cost abstraction, oddities with untyped literals, no way to declare "not null" pointers and the Million Dollar Mistake, built-in functions for built-in primitives (i.e., append(slice, datum) instead of slice.append(datum))
Stuff like that, which has been discussed over and over. Go is a bit of an odd language if you're used to languages like Ada, CommonLisp, or Racket, but I really like it a lot. I like the sense of pragmatism, that it has been developed to get things done.
I believe that Go2 will be even better and am especially happy that the Go team has decided to adjust and include generics rather than stubbornly insisting that they are not needed.
Considering the flexibility of the language as a whole, this is really cool!
The hardest part is probably to stop yourself from trying to applying solutions you learned in other languages into Rust. I caught myself multiple times trying to put things into python style classes, which failed horrible each time. The moment you grasp how to do things the rust way you will end up with solutions that are most likely more elegant, safe and fast than the thing that you tried to do first.
Over time (a few weeks) I managed to get a good enough intuition on Rusts concepts of ownership to not having to constantly think about it.
If a language could be grown from ML (Ocaml) roots (like Scala) instead of C++, it could be much smaller, cleaner and more pleasant to work with. Rust's only innovation is in the compiler tech, which could be ported and simplified (due to more predictable semantics of a functional language) to any ML-family language.
I cannot overemphasize how beautiful the pattern-matching with local bindings on algebraic data-types is, and what a wonderful thing is Erlang's pattern-matching on receive, and how, say, protobuf is basically product/record-types annotations, which could be done in a ML-family language itself etc.
Rust is under the curse of C++ (a statically typed and standardized dialect of PHP3) if you wish. It is obviously good language compared to C++, but somehow Ruby-ish, compared to ML-family languages.
It is actually a pity that Rust and not ML/Ocaml are considered cool and sexy by modern teenagers (like it used to be with Ruby and with Rails not so long ago). ML is much better starting point than C++. Perhaps, polished to perfection languages (Scheme, Haskell) are less appealing for the crowd being too dry, without ambivalence.
BTW, the next cool language definitely should be something like typed Erlang with Ocaml's syntax ;) - a hybrid into which typed Python or Typescript are growing into.
If you remove gc from ocaml, and added in compensating alternatives it would end up looking something like rust.
I think a lot of the adversting around rust in a "better c++" but its actually ocaml like but not mentioned to avoid scaring away traditional systems devs.
For example, everything should be a reference by default, and use of explicit & is stylistically bad.
Or why in let mut iter = a.iter(); iter is mut? It should be a simple closure which follows a protocol. In what sense it is mutable?
And such small warts are literally everywhere, together resulting in a clutter.
A functional language uniform defaults (everything is an expression, everything is a binding which implies everything s reference) are much better.
If it was developed with the goal of being an ML language, my guess is that a lot of what it does wouldn't be possible and it'd end up being another language very similar to OCaml.