30 ms·
Rust and the Future of Systems Programming [video]
- z3t4 10y agowhen you can run javascript on a pebble watch it blurs the boundaries ... Want to concat an number and string ? JavaScript wont complain.
- wyager 10y ago> Want to concat an number and string ? JavaScript wont complain. Is that supposed to be an endorsement?
- z3t4 10y agofoo = (string, number) => string + number Now go write that in your preferred language!
- wyager 10y agoWhy would I want to? Better to explicitly convert the number to a string.
- z3t4 10y agoThis is something you do often in JavaScript, for example: "You have " + messages + " new messages"
- kaoD 10y ago"You have undefined new messages" Glorious!
- z3t4 10y agoIt's very easy to spot the error here, compared to for example a segfault.
- lmm 10y agoThat's damning with faint praise if I ever heard it. (And it's not even true; undefined tends to propagate further, the segfault usually happens closer to the actual error. Not that I'm defending languages that segfault by any means)
- kaoD 10y agoNot to mention a SEGFAULT in Rust is a bug in Rust the language/std, not your program (unless you're writing unsafe code, which is pretty much never).
- wyager 10y ago"You have " ++ show messages ++ "new messages" This is type safe.
- colemickens 10y agoSo, since we're talking about Rust... print!("You have %d new messages", messages) Was that supposed to make me want to abandon all type safety and embrace a GC'd language that runs in a VM?
- z3t4 10y agoThere are advantages to GC, even Rust has runtime GC. But where is the memory freed ? You don't have to think of that at all in JavaScript. Also when something goes wrong with types in JavaScript the worst case scenario is "2"+2 turns into "22" witch is easy to avoid, compared to a silent overwrite/overflow. Even if the types in JavaScript is very loose, they are much safer.
- lmm 10y ago> There are advantages to GC, even Rust has runtime GC. If you want GC there are any number of good languages to pick with it (e.g. OCaml). > Also when something goes wrong with types in JavaScript the worst case scenario is "2"+2 turns into "22" witch is easy to avoid, compared to a silent overwrite/overflow. It's memory-safe but it's not safe. What if an error like that happens in your permission-checking code? I agree that silent overwrites and silent overflows should not happen and that language that have those things are bad, but that doesn't make silent type errors any better.
- z3t4 10y agoThe problem here is that + is used for both addition and concatenation. Most of the time you know what you are doing though (smile) and string is the default. When I started out with JavaScript I used -- (minus minus) for addition just to be safe. If you where to compare "22" == 22 ? it would be true, so the type doesn't really matter. If you want to do arithmetics on a string, no problem! Even null behaves like a teddy bear compared to other languages where it can bite you hard. Also note that this child toy language can run on embedded systems, and doing memory safe IO concurrency is so easy it's hard not to, like oops I did ten thousand concurrent request, but it finished in less then a second, because this is 2016 and not 1986 and computing performance and memory has grown exponentially since. Don't get me wrong though, systems languages has their place in lower level where the bits, bytes and performance matters. Someone once told me that JavaScript is a lot like assembly because you are so free, there is no one telling you "No, you shouldn't do it that way" like in Rust.
- nixos 10y agoAnd in Java, and in any language with operator overloading
- 0xAA55 10y agoWant to make a fast application on a pebble and with actual type checking? C and Ada won't complain or blur your lines... http://blog.adacore.com/make-with-ada-formal-proof-on-my-wrist http://blog.adacore.com/make-with-ada-formal-proof-on-my-wri...
- steveklabnik 10y agoYou can do it in Rust too; though most of the demos I see on GitHub are just demos.
- z3t4 10y agoAnd real programmers write in machine code. Want to get shit done ? Most systems now a day has more then 20kb RAM! Where do you draw the line between systems programming and non system programming ? And why not write some quick and dirty code in say JavaScript and then do what needs optimization in C/assembly ? Assuming you are not restricted to a CPU that cost less then a dollar. And where does Rust come in ?
- wyager 10y agoThere isn't actually a trade-off between efficiency and ease of use across all languages. For example, JavaScript is both slow and memory hungry while also being inconvenient to use.
- takeda 10y agoWith smart watches we still have problems, mainly to hold enough power. Yes, Pebble can last a week, but that's because it is running less resource intensive hardware, and even then 1 week is still laughable when comparing to old watches that require battery change once per 2 years. By being more conservative, you can achieve more with less resources.
- Retra 10y agoWhat kind of engineer goes around saying "It could be faster, leaner, and more efficient? No! Build the biggest, flakiest, ugliest thing that gets the job done today!"
- 10y ago
- bsder 10y ago> when you can run javascript on a pebble watch it blurs the boundaries And yet Javascript can't access a network socket or my flash storage in any useful portable way. Javascript is hampered by everybody trying to bolt on "security" after the fact and basically hobbling usage of the language.
- z3t4 10y agoYou also need a hardware abstraction layer with Rust, so why not use a higher level language like JavaScript or Haskell, besides optimizations and personal preference !?
- wyldfire 10y ago> GC pause ... sufficiently low power hw .. cheap phone Yeah, but even high-powered hardware can take a "major" hit from a GC pause when your application is extremely latency sensitive. IMO it would be great to get folks who write the enormous base of existing realtime apps driving critical devices everywhere to sit up and take notice of Rust. EDIT: I mean to say that many of my colleagues who write realtime software dismiss new languages as including GC baggage by default (because so many do!). So, hey, good that the video calls this out.
- vvanders 10y agoIt's starting to go that way but that's a very hard space to push new things into. I talk with all my ex-gamedev contacts and they're hesitant to even use lambda or other C++11 features that have been around for a while now. I think Mozilla's plan of driving things forward with Servo and using that as an large-scale example of the gains that can be made is a good approach.
- pron 10y ago> even high-powered hardware can take a "major" hit from a GC pause when your application is extremely latency sensitive. That's true, but high-powered, abundant-RAM realtime applications can use approaches that are cheaper than Rust's. See, e.g., the interesting work currently being done updating realtime Java[1]. The idea is that memory is composed of a few kinds of lifetimes: eternal, scoped and GCed-heap. Scoped memory is basically nested arenas, and GCed heap contains objects that are used by non-realtime portions of the app (which, even in realtime systems, may comprise the majority of code, especially when the system runs on large servers). An approach like Rust's, however, is crucial when the application is RAM and/or energy constrained. [1]: https://www.aicas.com/cms/en/rtsj https://www.aicas.com/cms/en/rtsj
- hinkley 10y agoIf I had infinite free time, I'd love to explore the problem space of implementing interpreters for GC-based languages on top of Rust. It's quite hard to get the concurrency right, and indeed we see a number of major languages that gave up on even trying.
- enqk 10y agoAlthough I am not against improving the safety of languages we use for system programming, the model that Rust advocates are pushing of "preventing mistakes" as a way to make systems secure doesn't convince me. Mistakes (and security breaches) happen. A system should be written in such a way as mistakes are few, indeed, however it is essential to also efficiently protect our users' assets (data) first, assuming that mistakes are being made. Ideally as a user I should not care much, nor can I trust that all software is "mistake free." I need the assurance and the tools to guarantee that 1) mistakes are detected 2) my data/privacy/identity is protected.
- gcp 10y agoNothing prevents you from doing both approaches. I mean, while Mozilla is increasing Rust usage, they're also rolling out more extensive sandboxing. Either of those by themselves are not a good enough solution though. Just trusting on Rust means you are vulnerable to Rust bugs or logic errors. Just trusting on sandboxing means you're hoping that your trusted code (written in C/C++) doesn't have any security bugs.
- sidlls 10y agoIt also means trusting that the "unsafe" usage in the Rust code doesn't have any security bugs.
- kibwen 10y agoIndeed, though trusting unsafe blocks in Rust is more tractable than trusting an entire C/C++ codebase due to the fact that unsafe blocks present a drastically reduced auditing surface.
- sidlls 10y agoThat's the contention, yes. In practice currently there is an incredible self-selection bias with respect to how tractable that position is if (when?) Rust becomes more widely used outside the circle of the True Faithful.
- leshow 10y agoRust is great. I've been following it since pre-1.0 and writing code with it for about as long also. It's really come a long way, my favorite language for pretty much anything except web development.
- deleted 10y ago[deleted]
- Narann 10y agoWow! You've got my attention! I mean, I feel many rust stuff (crates/dev/tools) seems to focus on high performance web so, as a low level guy enjoying bitwise ops and dynarec stuff I was wondering if rust what a good thing for me or if it would be better to stick in C. Can you tell me which kind of project you do in rust, what was your original language and why rust shine compared to your previous language?
- dj-wonk 10y ago(different person here, but I wanted to reply) I'm not sure that I agree as strongly as the first post on this branch, but I really do enjoy Rust. I'm using it for a particular tree-search with pruning computation that caches to RAM and saves to disk. The speed, memory compactness, and correctness are very beneficial. I will admit that getting comfortable with the borrow checker has taken some time, and I still have more to learn!
- leshow 10y agoI started on Java in school for software eng. After that I did a lot of front and backend development in dynamic languages and forgot all about types. Until I discovered Haskell and saw what a really powerful type system can do. Rust's type system is very very similar to haskell's if you substitute the word 'trait' for 'typeclass'. However code is imperative, so that's nice for some applications, and is faster/lower level. I've used the crate nom (https://github.com/Geal/nom https://github.com/Geal/nom) in the past, it's a parserc library for consuming bits/bytes. I used it to write a function that consumes a vector of unsigned bytes, 11 bits at a time. If you're interested in that sort of stuff, take a look for yourself and see if you like it. As with most things in Rust nom generates parsers with little to no runtime overhead, so you pay nothing for the increase ergonomics.
- shmerl 10y agoDoes Emscripten support Rust already?
- gcp 10y agoAFAIK yes but not in a "production ready" way.
- steveklabnik 10y agohttps://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627 https://users.rust-lang.org/t/compiling-to-the-web-with-rust...
- shmerl 10y agoThanks, I should experiment with that.
- wyldfire 10y agoYes. See [1] for details. [1] https://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627 https://users.rust-lang.org/t/compiling-to-the-web-with-rust...
- etherealG 10y agoThanks so much, I was digging into this a few weeks ago eagerly and didn't find anything. Glad it's here now!
- deleted 10y ago[deleted]
- Animats 10y agoUnfortunately, this is just a promotion for a series of videos. Probably talking head videos with PowerPoints. Most people who do systems programming probably already know about Rust. They may not have used it, but know it exists. What's "Hacks"?
- kibwen 10y agohttps://hacks.mozilla.org/ https://hacks.mozilla.org/ ("Hacks" for short) is Mozilla's blog for technical content focused at developers, as opposed to their outlets aimed at normal Firefox users or general web advocates.
- steveklabnik 10y ago> Probably talking head videos with PowerPoints. Almost everyone in this video is an engineer on Rust, Servo, or Firefox. The exception is Dave Herman, head of Mozilla Research. These are unscripted responses to questions, no powerpoint involved. > They may not have used it, but know it exists. There are a lot of programmers in the world, and many of them don't read Hacker News. I meet new people who have never heard of Rust every week almost. Or may have heard of it, but can't tell you what it's for, just vaguely remember hearing the name. Or have heard of it, but remember their first impression from a pre-1.0 version and haven't listened since. ("How's its GC?")
- kibwen 10y ago> but remember their first impression from a pre-1.0 version Can confirm, I routinely observe people in the wild dismissing Rust based on the existence of the `@` and `~` sigils, not realizing that we removed those years ago. :P
- wyldfire 10y agoI dismissed it when I first heard about it (prob just prior to 1.0). I saw "Mozilla" as a primary sponsor and just knee-jerk assumed it was part of the what-if-we-put-JS-here mania. Thankfully due to repeated popularity on HN I gave it a try and I'm a convert now!
- pimeys 10y agoNow I have four services running on production, all written with Rust. If it compiles, it usually works. Of course you have these late night sessions where you write that one unwrap() because, hey, this will never return an error, right? And bam... I'm seriously waiting that tokio train to be stable and a unified way of writing async services without needing to use some tricks with the channels or writing lots of ugly callback code. Also the native tls support is coming and the dependency hell with openssl would be gone forever. If you need http server/client, I'd wait for a moment for Hyper to get their tokio branch stable and maybe having support for http2 by migrating the Solicit library.
- kibwen 10y agoSpeaking of HTTP clients, just yesterday the person behind Hyper announced their new high-level HTTP client crate: http://seanmonstar.com/post/153221119046/introducing-reqwest http://seanmonstar.com/post/153221119046/introducing-reqwest
- Animats 10y agoNot sure what to think of that. Does everything have to be async I/O now? How often do you need massive numbers of client connections?
- steveklabnik 10y ago1. This introduces a primarily synchronous API for now. Async will come later. All those code samples are synchronous. 2. Async I/O is an extremely hot topic in Rust right now, so it's likely that Rust people do care about it.
- dbaupp 10y agoI assume you're talking about why reqwest is necessary (i.e. why hyper is moving to async), rather than the single paragraph mentioning asynchronicity as a possible future direction for reqwest? Async I/O is important for more than just multiplexing a million requests. Hyper is moving to it for that purpose, and also because it is a more natural way for working with in-flight I/O, e.g. cancelling requests or selecting over them.
- pimeys 10y agoNow I have four services running on production, all written with Rust. If it compiles, it usually works. Of course you have these late night sessions where you write that one unwrap() because, hey, this will never return an error, right? And bam... I'm seriously waiting that tokio train to be stable and a unified way of writing async services without needing to use some tricks with the channels or writing lots of ugly callback code. Also the native tls support is coming and the dependency hell with openssl would be gone forever. If you need http server/client, I'd wait for a moment for Hyper to get their tokio branch stable and maybe having support for http2 by migrating the Solicit library.
- cryptrash 10y agoI'll never use rust for anything important. Too dangerous, unstable, badly organized, toxic development community, the list goes on.
- shmerl 10y agoHuh? Did you mix it up with something else? Rust community is one of the best. And what's "dangerous and unstable" there?
- cryptrash 10y agoOf course I didnt. Klabnik is practically a communist, lots of anti-American sentiments, etc. Pcwalton has been spamming HN for ages about rust. They're all terrible. I've heard rumors of memory vulns in rust as well.
- steveklabnik 10y agoI make it a strong point to keep my personal politics outside of Rust; there's actually many people who work within Rust and its community that I would fight bitterly with about politics, but we instead focus on the technology and work together in a productive manner. If you see me acting inappropriate within Rust project spaces, please report me to the moderation team: the core team is subject to moderation just like anyone else,and no core team members are allowed to be part of moderation for exactly that reason. > I've heard rumors of memory vulns in rust as well. Please report these to https://www.rust-lang.org/security.html https://www.rust-lang.org/security.html, as we care deeply about fixing them, if any. Otherwise, that's just FUD.
- deleted 10y ago[deleted]
- yedpodtrzitko 10y ago> I've heard rumors of memory vulns in rust as well. I guess you did read it on the internet, so it has to be truth. Are you referring to that clickbait "Heartbleed in Rust"?
- VoidAgent 10y agoIMO C++ is unstoppable now, c++ 11, 14 and 17 additions with GSL and all things in the pipeline ...
- kibwen 10y agoRust doesn't need to stop C++ to be successful. The market for programmers is already large enough to successfully support dozens of programming languages, and that market will only continue to grow. PHP didn't "stop" Perl, Python didn't "stop" PHP, Ruby didn't "stop" Python, and yet all of these languages continue to be enormously successful. Why should we expect a monoculture on the systems side?
- user5994461 10y agoWhat's the place for Rust in the market? The distributed systems have already moved to Go (when it's not Java/C# :D). The system programming is done in either C or C++. (Depending on history and availability). The oldest stuff and/or most constrained is stuck with C. They're struggling to have anything moved over to C++. Rust is entirely out of question.
- baq 10y agoand yet the ecosystem grows every day.
- deleted 10y ago[deleted]
- gcp 10y agoThe system programming is done in either C or C++ Rust is addressed to some of the shortcomings of those. This implies there would a competitive advantage of doing systems programming in Rust, if it succeeds in addressing them. So far, it does look like it's succeeding there.
- takeda 10y agoRust overlaps with C/C++ and even with Go. Go was initially trying to be a replacement for C/C++, but hasn't succeeded, because it is too high level. Rust on the other hand looks very promising in that area, which requires low level access but also desires safety.
- gutfuck 10y agoI've literally seen you tweet at people to kill themselves and then delete it. Idk about any of this other stuff but you certainly can't claim that your hands are clean in all this.
- steveklabnik 10y agoI do not tell people to kill themselves, as that's not cool. That said, I'm not interested in replying to brand new accounts made to troll me (and conveniently without evidence), so I won't be replying further.
- gutfuck 10y agoI'm sure you won't, don't want somebody to see this and post some screenshots. Wish I had taken some myself!
- seeekr 10y agoHe's obviously a troll or something. Keep up the good work, Steve! Rust's community is one of the most amazing and friendliest I've ever seen anywhere on the internet, and it seems to me that your intent, effort and presence is a significant part of that :) (Not to downplay any other people's contributions!)
- sctb 10y agoWe've banned this troll account. You can't create new accounts just to violate the guidelines. We detached this subthread from https://news.ycombinator.com/item?id=12970047 https://news.ycombinator.com/item?id=12970047 and marked it off-topic.
- deleted 10y ago[deleted]
- djhworld 10y agoI keep trying to learn rust but fail miserably. They do say on their website that there's a hump that you have to climb over before everything fits into place, which is probably applicable to everything you'll learn, but sometimes I think that hump is too much of a hurdle
- steveklabnik 10y agoHow are you trying? What are you getting stuck on? I'd love to improve things.
- q3r3qr3q 10y agoI'd get excited and go through some tutorial on their website, probably the main? tutorial, bu then when you get to the lifetimes section is seemed to get really complicated instantly. I tried twice and think I hit the same problem. Maybe some more good examples would help?
- steveklabnik 10y agoMakes sense! I'm working on a second draft of the book right now, and it's making that stuff more clear. http://rust-lang.github.io/book/ http://rust-lang.github.io/book/ is the draft; the lifetimes bit hasn't landed yet though.
- rjammala 10y agoDid you go through these screencasts? http://intorust.com http://intorust.com
- cbHXBY1D 10y agoNot specifically about your book, but I would love if there was a quicker way to find methods in the docs. Right now, if I want to find the methods used by BTreeMap you have to wade through a good amount of information until you can find how to just get the keys. I'm currently on mobile where the issue is more prominent.
- CodeMage 10y agoI'd love to see someone write a game engine in Rust to compete with the "big boys" like Cry or Unreal. C++ game code can be such a nightmare.
- jcoffland 10y agoIt would be in Rust too.
- CodeMage 10y agoTrue enough. However, I'm willing to bet that a non-trivial amount of nightmarish code in C++ comes from the language itself. Also, I'm willing to be that a Rust build would be an improvement over a C++ build. As an example, I'm really sick of header files.
- madmax96 10y agoMaybe, maybe not. I think that you can write horrible code in any language (albeit horrible rust is safer than horrible C++ obviously). Especially considering the case when you're working on extremely compressed deadlines like many game shops, you're always in for a nightmare.
- nercht12 10y agoYes and no. Rust adds its own set of hassles. You think building becomes a synch? With Rust, you're fighting the compiler probably more than with C++. I'm sure some game developers would rather have an occasional crash they can fix down the road after their game is published than be forced to make a perfect system the first time. Remember, with game production, it's about time-to-market, not about perfect code.
- alkonaut 10y agoBeing able to cut corners with code hygiene works both ways though for productivity: you don't want to realize a week before a deadline that you have a hard-to-find memory leak or crash. A lot of the time it feels like rust development is slow because you are fighting the compiler. On the other hand once you run the program you often get that Haskell-y "it worked because it compiled" feeling. With a normal OO language I often build/run just to spot the next place I have made some bad assumption that the compiler didn't catch.
- harveywi 10y agoThe state of Rust editors continues to evolve [1], but I would be curious to learn more about the editors/IDEs that people are using for Rust development. Any stories or thoughts? [1] https://areweideyet.com/ https://areweideyet.com/
- vvanders 10y agoVSCode + Racer have been working really well for me. Pretty decent auto-complete and integration.
- endisukaj 10y agorust-mode[0] has worked well for me so far. But I haven't written anything major with rust yet. [0][https://github.com/rust-lang/rust-mode https://github.com/rust-lang/rust-mode]
- allengeorge 10y agoI'm using IntelliJ-Rust [1]. Doesn't go to the definition of macros, and sometimes auto-complete doesn't work, but - it's comfortable enough to use. [1] https://intellij-rust.github.io/ https://intellij-rust.github.io/
- baq 10y agovim + racer do the job, but you have to annotate types quite a bit for autocomplete to work. I'd love it if there was a way to auto-annotate variables like the haskell plugin does it.
- deleted 10y ago[deleted]
- qwertyuiop924 10y agoWell, I'm an Emacs user. I don't necessarily care about the tools that more IDE focused people might (OTOH, RMS should loosen up on the AST: you can't afford to lose much more than you already have), but rust-mode works fine for me.
- hawkice 10y agoI use Emacs, mostly because my workspace has gotten too big for Atom to be consistently responsive (I've got dozens of projects with tens of thousands of lines of code and who knows how many files deep in the dependency managers internals).
- user5994461 10y agoI'd like to see an analysis: "The amount of real world jobs available for Rust, in comparison to Ada." The numbers may be self explanatory.
- gcp 10y agoWhat would they explain though?
- wyldfire 10y agoThey would explain Rust's relative youth and corresponding growth opportunity. ;)
- user5994461 10y agoAda was designed for system programming and, at a time, was also a young language with a huge opportunity for growth ;)
- staticassertion 10y agoTo compare Ada's history to Rust's is silly. Even if the languages have a common goal of safety, the projects themselves are fundamentally different in many many ways. One of which is the fact that Ada was designed by the DoD for the DoD, and required a verified compiler, etc etc etc. They're totally different projects, even if the languages have a small number of shared goals.
- hubert123 10y agostill compiles too slowly, a language in 2016 just cannot take multiple seconds for me to use it add 5 crates and watch ur compile/run cycle climb to a cool 10+ second average.
- steveklabnik 10y agoWe had significant compile-time improvements in the release yesterday, with more to come in the future. Also, you might want to give incremental recompilation a try, it's nightly-only for now, but being actively worked on. > add 5 crates and watch ur compile/run cycle climb to a cool 10+ second average. It should not recompile those crates each time, if it does, that's a bug. Please report them!
- coolsunglasses 10y agoJust to litmus test this, I rebuilt a small Rust project of mine that depends on 41 crates. Debug build took 15 seconds, release build took 37 seconds. Rebuilds are sub-second. This is 0.15 nightly. TBQH, Rust's release builds are already faster than GHC's -O0 builds for me. I'm still bereft a REPL (I live in a REPL), but it's not a deal-breaker.
- nnethercote 10y ago> It should not recompile those crates each time, if it does, that's a bug. Please report them! Depends on the inter-crate dependencies, alas. Touching one crate can easily cause multiple other crates to rebuild.
- steveklabnik 10y agoOnly if you need to modify both crates; not if you're just adding them as dependencies, because then you're not modifying them. I was assuming that's what the parent was doing, due to their wording, but that might have been a bad assumption.
- computerphage 10y agoIncremental compilation is stabilizing on Nightly. It won't help the initial compile, but waiting even 5-10 Minutes when I start working on a new codebase doesn't really matter to me. It's only the incremental speed that I care about.
- KeshandKooley 10y agoGo watch my YouTube video everyone! And remember to Subscribe ️️️ https://m.youtube.com/watch?v=QRQPSp-vTd4 https://m.youtube.com/watch?v=QRQPSp-vTd4
- anfroid555 10y agoAnyone know a tutorial course for someone only knowing high level languages. And not c or Ruby. More JavaScript, PHP, nodejs, Python
- oldsj 10y agoRust for rubyists?
- steveklabnik 10y agoIt basically doesn't exist anymore; I stopped maintaining it pre-Rust 1.0.
- salicideblock 10y agoI did one of the rust-koans out there and it went very well. Can't really remember which one, though...
- quotemstr 10y agoI lament what Rust could have been had its designers not jumped on the anti-exception bandwagon. Rust's error handling is bad and makes me prefer C++
- IshKebab 10y agoSeriously? Rust's error handling is great, and frankly I'm glad that exceptions have gone out of favour. I tried them but they never really delivered their promise. At their best they do is give you nice stack traces. At their worst they make error handling stupidly verbose, they erase the context you need to properly handle errors, and they make it much more difficult to even know which errors can occur! Rust's solution is the best I've seen so far. Go's multiple return values are pretty good too but I think Rusts's is better.
- quotemstr 10y agoI very strongly believe exceptions are a lot closer to optimal than Result is. Exceptions remove the need for inline error checking code and make it possible to implement types with value semantics. You can't have reasonable value types that own resources if you need explicit error checking. The need for explicit error checking makes OOM handling in Rust awkward at best. I've ranted about this side effect before. Also, in Rust since we can panic, we need to worry about exception anyway! Rust has the worst of both kinds of error handling. Exceptions are anti verbosity: you're supposed to let them propagate, not catch and rethrow them. They don't erase context: they preserve it, since an exception object is constructed as close as possible to the error site that caused it. I realize that I have a minority view, but I'm utterly convinced that I'm right and that I'm living in a world gone mad. I've written a ton of code over the years. At least hear me out and try to understand my perspective.
- tupshin 10y agoPersonally I love Rust's error handling, but I do think that I understand your perspective. At least part of your objections would seem to be addressed by the combination of the ? operator to make it trivial to do the equivalent of re-throwing inline, and the error-chain crate, which can make exception-like stack traces/etc trivial to implement. https://brson.github.io/error-chain/error_chain/index.html https://brson.github.io/error-chain/error_chain/index.html
- htaunay 10y agoCongrats to all the Rust team! Love the zero-cost abstraction approach, love the good practice compiler warnings, love the cargo ecosystem, love the markdown code dox that tests the example code. First time I actually enjoyed reading a programming language's documentation.
- deavmi 10y agoI agree. We need safer languages. Not that I know much about safety. I still know we need it.
- mavsman 10y agoCoincidence that many of the Rust promoters have red hair?