16 ms·
Announcing Rust 1.6
- nikolay 11y agoI think Rust badly needs an AWS SDK as a lot of systems software is being written now in Go...
- EugeneOZ 11y agoSomething like this? https://github.com/rusoto/rusoto https://github.com/rusoto/rusoto
- nikolay 11y agoThat has around 5% of the full AWS SDK coverage...
- dikaiosune 11y agoLike this? https://crates.io/crates/rusoto/ https://crates.io/crates/rusoto/ Haven't tried it yet (backwaters don't usually look kindly on AWS :) ), but that looks like what you're talking about. There are a ton of libraries for Rust these days (relative to the amount of time since 1.0, at least).
- hrez 11y agoYes, except with ec2 and tons of other missing AWS services support.
- Perceptes 11y agoRusoto maintainer here: The different AWS services are added to Rusoto through code generation based on service definitions from the Python project botocore. We're in the process of moving our code generation from Python to Rust, and once that's in place, we'll be adding remaining services pretty quickly.
- nikolay 11y agoGreat to hear this! I really don't want to migrate from Python to Go, but I'll gladly do Python to Rust! I'm sure I'm not the only one!
- monkmartinez 11y agoI would like to hear why you would not move to Go... I am a Python guy.
- nikolay 11y agoGo lacks an elegant and predictable syntax, unlike Python and Rust. Also, Rust is more potent as a language, it's safer, and it has crates - I prefer a centralized package management as it helps discovery, rating, analytics, and other things we know work great with RubyGems, PyPI, and NPM.
- bjz_ 11y agoGreat to hear! We are moving more and more to AWS at work, and it would be great to use Rust with it!
- curun1r 11y agoIt's too bad that compiler plugins / libmacro are still so experimental. Once they're stable, the kind of code generation you're doing as a separate step could be done entirely at compile time. I did some preliminary tests with an eye towards an AWS crate, but decided that a crate that only works with nightly and frequently breaks is of dubious value. Still, it's cool that the Rust compiler will eventually be extensible enough to compile json directly. Anyways, thanks for Rusoto. It's going to make a project I'm starting next month significantly simpler!
- Perceptes 11y agoYes, I've been following this issue closely. Nick Cameron is working on a revamped macro system that will replace the current compiler plugin system for the purposes of syntax extensions. It's probably still gonna be a while, unfortunately, since it'll take some time to get that kind of stuff vetted and baked into the language. Here are some recent posts by Nick on his experiments and progress (in order of publication): * http://www.ncameron.org/blog/macro-plans-syntax/ http://www.ncameron.org/blog/macro-plans-syntax/ * http://www.ncameron.org/blog/procedural-macros-framework/ http://www.ncameron.org/blog/procedural-macros-framework/ * http://www.ncameron.org/blog/libmacro/ http://www.ncameron.org/blog/libmacro/ Pretty much all of his recent blog posts are on the topic, so it's worth browsing through all of them if you're interested.
- zcdziura 11y agoWhat do you mean when stating that applications aren't supported for developing around libcore?
- steveklabnik 11y agoSpecifically, there are two 'weak lang items' that need to be defined. Lang items are not yet stable. So while you can build libraries with only core, the final binary still needs to be compiled with nightly. For now. Furthermore, you can use a no_std library with an application that uses std just fine. The use case not quite covered is "I want an application with no standard library at all, period."
- JoshTriplett 11y ago> Specifically, there are two 'weak lang items' that need to be defined. Lang items are not yet stable. What two specific items? By "lang item" here, do you mean roughly "symbol", or something else entirely?
- brson 11y ago'lang item' does roughly mean symbol, but they have their own Rust syntax to communicate their existence to the compiler. Lang items are special functions / types that can only be defined once globally, must be defined for certain features to work. They are how the standard library hooks into the Rust language for a variety of purposes, and to a large extent what makes it possible for Rust to define much of its functionality in libraries instead of in the language. The two lang items that are absolutely required but not defined in core are 'eh_personality' and 'panic_fmt'. Read more here: http://doc.rust-lang.org/nightly/book/no-stdlib.html http://doc.rust-lang.org/nightly/book/no-stdlib.html
- steveklabnik 11y ago$ cargo new example --bin $ cd example $ cat > src/main.rs #![no_std] fn main() {} ^D $ multirust run stable cargo run Compiling example v0.1.0 (file:///home/steve/tmp/example) error: language item required, but not found: `panic_fmt` error: language item required, but not found: `eh_personality` error: aborting due to 2 previous errors Could not compile `example`. In general a "lang item" is some portion of Rust that the language expects to be defined in some manner. They must all be defined for compiling to work. `libcore` defines many of these language items, but does not for these last two. `libstd` does. You can provide your own: #[lang = "eh_personality"] extern "C" fn eh_personality() { } #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } These are enough to get going, but actually using `#[lang]` requires a `#![feature]`, which requires nightly. You also end up needing #[start], which is also behind a feature gate. The documentation brson linked you to contains an example no_std executable.
- dikaiosune 11y agoMay the libc event never occur again (at least, I think it was libc with the wildcard dependencies). That's great to hear.
- steveklabnik 11y agoYes, that was part of it. It was a complicated situation, from which we all learned a lot. (For those not familiar: the libc crate went from 0.1 to 0.2. Many people were depending on libc="*". Cargo allows for multiple copies of a library with incompatible versions. But the releases were incompatible for a reason... it caused problems. This fix is one of the things we're doing to address it, there's more coming in the future.)
- djb_hackernews 11y agoI've poked at the language a bit over time and while I don't think I'll ever "get" rust, I can say the folks in #rust on irc.mozilla.org are friendly and helpful, which can't be said for all languages.
- dman 11y agoIs this you - https://en.wikipedia.org/wiki/Daniel_J._Bernstein https://en.wikipedia.org/wiki/Daniel_J._Bernstein ?
- lambda 11y agoFrom the comment history, I don't think they are the same djb.
- nickpsecurity 11y agoBest not to even ask such a question as it invites dishonesty. Just look up the contact information and compare. Here's DJB's: http://cr.yp.to/contact.html http://cr.yp.to/contact.html
- nickpsecurity 11y agoThe docs stomped me, too. I sent suggestions for metaphors and such that might help confused people. They're hard at work on the issues from what I've seen, though. So don't give up yet: check back in a year or so to see if revisions bring you extra clarity. :)
- VeilEm 11y agoCongratulations! I'm loving Rust, it's my go-to default language now. I'm going to start messing around with piston.rs to make some basic 2d games. I already wrote an irc bot with Rust. For those wondering, stable just meant the API defined for interactions with some libraries were subject to change. It wasn't like a problem with using the APIs, it was just the developer has to know that new releases might change how they worked or if they would even be available in the future.
- chocolatebunny 11y agoHow are the software libraries for Rust? What did you do for network access, string manipulation and GUI stuff?
- VeilEm 11y agoThe string manipulation is good in Rust, but in Rust strings are unicode and characters are unicode codepoints. IRC is an ASCII protocol and so I went with using binary slices `[u8]` for parsing. For network stuff I used openssl[0] and std::TcpStream [1] I didn't use a GUI. I plan on using piston.rs[2] to build games but there are Qt, GTK+ and even Cocoa integrations for rust. [0] https://crates.io/crates/openssl/ https://crates.io/crates/openssl/ [1] https://doc.rust-lang.org/std/net/struct.TcpStream.html https://doc.rust-lang.org/std/net/struct.TcpStream.html [2] http://www.piston.rs/ http://www.piston.rs/
- fpoling 11y agoYes, its a pity that Rust requires that strings must be UTF-8. Go designers got it right as their strings are just immutable sequences of bytes making them very suitable for network protocols and binary data.
- heinrich5991 11y agoThat's what Rust has byte slices for: `b"abcdef"`
- Cshelton 11y agoThis is relevant and cool, UPenn now has a course for Rust - http://cis198-2016s.github.io/ http://cis198-2016s.github.io/ You can follow along, all slides and HW are on github.
- blakesterz 11y agoThat setup is great, that's all on github? Is there a How-To around that I could follow to put something like that together?
- deleted 11y ago[deleted]
- astockwell 11y agohttps://pages.github.com/ https://pages.github.com/ They probably should have prepended the school name to their GitHub org, but that's just my 2 cents :)
- it_learnses 11y agoWhy does the first page for the intro lecture slides say Intro to Cobol and then two pages later, Intro to Rust? Are they trying to troll?
- dikaiosune 11y agoNot all jokes are trolls.
- it_learnses 11y agoDown boy. I meant trolling in a joking way.
- nickpsecurity 11y agoMaybe to illustrate the difference between programming for pay and programming for fun that many students might eventually experience. They use an extreme example to scare away those who aren't committed enough. ;)
- lasermike026 11y agoVery exciting!
- zackify 11y agoFunny that I made this the day before Rust gets to the top of reddit :D https://github.com/zackify/match https://github.com/zackify/match
- EugeneOZ 11y agoKeep going! Thanks to all contributors for their work on this awesome language and crates. I use Rust for web as REST API and I'm absolutely in love with this language. Maybe first steps were little bit steep, but it's worth it :) // cargo run!
- smt88 11y agoWould you be kind enough to list the crates that your API is using?
- EugeneOZ 11y agoOf course. Special thanks to their authors ;) [dependencies.iron] version = "0.2.*" [dependencies.bodyparser] git = "https://github.com/iron/body-parser.git" [dependencies.redis] git = "https://github.com/mitsuhiko/redis-rs.git" [dependencies] router = "*" rustc-serialize = "*" plugin = "*" rand = "*" toml = "*" rust-crypto = "^0.2" hyper = "*" r2fa = "*" urlencoded = "*" regex = "*" [dependencies.mysql] default-features = false features = ["socket"] And soon here will be added "rusoto".
- steveklabnik 11y agoSome TOML syntax you may not be aware of: [dependencies.redis] git = ... is the same as [dependencies] redis = { git = ... } This will let you have just one [dependencies] block, which is a bit nicer looking. I've been changing examples to use it instead of that older style; they're equivalent if you prefer it though.
- dbaupp 11y ago(Life will be easier for you in future if you avoid * constraints, by using things like `router = "0.1"` instead. This means authors can make breaking changes to their crates without breaking you, e.g. router might make a major change and release 0.2.0, but you'll still be able to run `cargo update` without risking picking that up.)
- valarauca1 11y agoActually managed to sneak some Rust into production. Nobody cares what language you wrote the DLL in, just that it does what the docs say it should do.
- eterm 11y agoSaid no one who has to maintain others' software.
- humanrebar 11y agoIt's a fair point, but there's a lot of write-only Perl, PHP, and C out there. Let's make sure we don't hold new Rust code to a higher standard that that stuff.
- zenlikethat 11y agoIdeally we should hold all new code to a higher standard than that. All programmers spend much more time reading code than writing it. Likewise, Rust is not finalized as a language yet. That means whoever has to maintain the original commenter's code is likely to be in for a rough time if and when they ever attempt to bump the Rust version.
- steveklabnik 11y ago> Rust is not finalized as a language yet. It is just as finalized as any other language. > if and when they ever attempt to bump the Rust version. If the parent is using a stable release, like this 1.6 is, then bumping the version should be all they need to do. (Unless they're relying on a safety hole for some reason; we do fix those)
- zenlikethat 11y agoFair enough- I wasn't familiar with Rust's backwards compatibility guarantees and had heard a bit about breakage, so thanks for pointing that out.
- haberman 11y agoSince this release is focused on stabilizing libcore for embedded use, it seems a good time to ask a question that's been on my mind. C11 (and C++11) defined a memory model and atomic operations for shared-state lock-free concurrency. But that model and the atomic operations aren't being used by Linux, because they didn't match up with the semantics of the operations that Linux uses. (See https://lwn.net/Articles/586838/ https://lwn.net/Articles/586838/ and http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0124r0.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p012...). I'm curious what Rust says about this. Does Rust have a memory model like C11/C++11? I'm curious whether Rust (and C11/C++11 for that matter) will evolve to have primitives like what the Linux kernel currently defines and uses.
- steveklabnik 11y agoWe do not have a formal spec yet, and so do not technically have a memory model like C or C++ do. However, since we're built on LLVM, we do have some semantics that are pretty much based on it. Our atomics stuff is pretty much LLVM's. A lot of the work going into forming said models is trying to determine how much of LLVM we've let pollute into the language in the meantime and where it's feasible to diverge. https://github.com/rust-lang/rfcs/issues/1447 https://github.com/rust-lang/rfcs/issues/1447 is a good thread if you care about this topic.
- johnbender 11y agohttp://plv.mpi-sws.org/rustbelt/ http://plv.mpi-sws.org/rustbelt/ As part of defining the Rust semantics they will certainly tackle the question of the memory model. Dreyer and company have a track record of providing semantics and reasoning principles for weak memory models (like C11). You might have to wait a while for a rigorous semantics though.
- hellofunk 11y agoI'm curious if what you mean is that C++11 has a standard spec for the memory model you describe, but if Linux doesn't use it, then Linux does not actually adhere to the C++11 standard? Does that mean that Linux C++11 compilers are non-standard in general?
- criddell 11y agoI have a question for Rust fans: how do you deal user interaction? Do you have a favorite user interface library? Do you separate the UI from the program and communicate either via IPC or http+html? If you don't care about cross platform capabilities, is there a great library on the platform you do care about?
- allan_s 11y agoI was wondering: As the HN crowd seems to have quite a lot of Rust supporters, would it be a good selling point in a job description ? i.e if (it's just currently a personal hypothesis) a company were to consider to (re)write some part of its Rest-ish microservices and that Rust was the chosen language, and was looking for people to help on that, would it make a `interesting++` in your mind ? for real services used by real people by a not-so-startup company, in europe. edit: I already deployed in production for my previous company some (with a very stricly limited scope) microservices in rust (with everyone approval) and it was quite a success, so I'm more and more thinking that rust is now enough developed to fit the market of language for microservices, as it's more or less "understand HTTP, read/write from redis/postgresql/mysql/memcache, do some transformation in between" and Rust now support these operations quite well
- dikaiosune 11y agoA friend of mine asked me about this last weekend, and I basically said that I've drunk enough kool-aid at this point to do anything to use it as my main work language. I'm lucky enough right now to have a lot of autonomy for my projects, and I'm using that to build some tools in Rust, but it's different than being able to focus on it full time.
- seivan 11y agoI know the feeling. I'd sacrifice my own free time to fill the gaps I know it's missing from Rails, it's only fair as I would operate 10x faster with things I'm comfortable with and has a full set toolbox. Considering Rust but, would prefer Swift or Typescript.
- azdle 11y agoIt would be for me, but like dikaiosune I've drunk the Rust koolaid almost fully by now. But honestly, even if I hadn't it's be a selling point to me because it tells me that you're a place that isn't stuck writing everything in a single language but are willing to try new things are willing to use what seems to be the right tool for the job.
- wyldfire 11y agoW00t, I made the contributor list!
- steveklabnik 11y agoThank you for your contribution!
- wyldfire 11y agolol it was a paragraph or so of a doc revision. But I'll take it. :)
- steveklabnik 11y agoEvery bit helps, seriously. No contribution is too minor, in my opinion. People think that only big stuff counts, but my career is literally built off of paragraphs of doc revisions.
- sdegutis 11y agoAfter trying to understand some Rust, it seems to me that it's just as complicated as C++, from the programmer's perspective. Was I mistaken in thinking that being simpler to program in than C++ was one of the goals?
- dikaiosune 11y agoWhen I've dabbled in C++ in the past, worrying about safety (does my custom trie implementation segfault? is this iterator still valid? can I trust the code I just vendored into my repo?) was the main source of complexity, both in initial writing of my code and in debugging it. Working in Rust has been a comparative (and simple) delight for me.
- steveklabnik 11y agoWe have a number of similar features, but ours are generally more straightforward since we didn't have to worry about backwards compatibility. We also have some features that C++ does not, and they have some we do not.
- dbaupp 11y agoRust's memory management strategy has been described before as "you have to think about it, but you don't have to worry about it", which I think applies to the language more broadly in terms of a comparison vs. C++. The latter is very flexible and powerful, but generally assumes the programmer is perfect, meaning mistakes often won't be caught at compile time and are often subtle to track down, while Rust has the assumption that humans are fallible, so many mistakes are caught. The fact that they're caught means learning Rust front-loads a pile of things, because the compiler complains about them, which can easily make Rust seem more complicated despite the core concepts of ownership/borrowing really being a subset of modern C++.
- echelon 11y agoI don't use C++ or Rust in a daily context, but I can say without a doubt that Rust is the easier language to grasp. I don't have to decide anything about headers, linking, Makefiles, etc. to get things up and running; I can declare dependencies in Cargo.toml and it just works. The Rust standard library feels so much more modern and easy to use than the STL. The documentation is fantastic, too. C++ pointers, casting, OO, templates, and all the billion other language features feel like traversing down a rabbit hole. Rust is small enough to grok in a day. The syntax is incredibly expressive and a joy to use.
- kevindeasis 11y agoSo, I've recently tried to figure out what rust it's been getting lots of attention in HN. So, it allows you to have safety and control. I thought that is very neat. I've got three questions for experts. One, what type of applications is Rust intended for? Two, I like JS because I can code in the client, and server in one language. Will there ever be a web server framework for rust and an api that allows me to modify the dom? Three, what are your predictions for the future of rust?
- glennsl 11y ago1. Rust was designed for low-level systems programming, and in particular the multi-threaded kind, where performance and memory control are important. So things like web browsers (it's been developed alongside development of the Servo web browser), games, operating systems, embedded systems etc. It's basically a better C++. 2. There are already several web frameworks, in various stages of earliness. See [1]. I don't think it will ever be a good idea to write Rust client-side though (even though I believe there is an emscripten backend for it, so it's possible). 3. I see a very bright future for Rust. It could use some ergonomic improvements (but it's miles ahead of C++ even now, mind you), but is otherwise a very well designed language that fits very snuggly in its niche. And it has some very strong backing from Mozilla. I expect it will slowly take over large amounts of territory from C++ and possibly from C, as these developers start to realize the benefits of Rusts safety guarantees. It's also quite unique in that its safety entices many higher-level (python, ruby, C# etc.) developers into trying system programming, which could be really transformative to the system programming scene. For example, one thing that has already come out of this is the cargo package manager, which is similar to npm, bundler etc. but (before cargo) had yet to find its way down to the lowly systems programmers. Many (former?) C++ developers actually tout it as one of the major benefits of Rust. [1] http://rustyprogrammers.com/2016-01-web-frameworks http://rustyprogrammers.com/2016-01-web-frameworks
- kevindeasis 11y agoThank you, that was very informative and very helpful! I will definitely start learning Rust!
- 11y ago
- imakesnowflakes 11y agoI have looked at both Rust and Go. What I have felt is that, Rust is too restrictive. I mean, you have to fight the compiler a lot harder then you have to do in Go. Some times, for example, if you are writing device drivers or real time embedded programs, then that is great. But for web services? I think it is overkill. I think Go strikes a nice balance. I would love to be convinced otherwise though. So please tell me, what am I missing?
- pjmlp 11y ago- expressive language, including support for FP - no need to copy-paste code for generic algorithms - proper dependencies management
- osoti 11y agoUndertaker had kept the name “Cain the Undertaker” during his career, read this and more on WWE: http://goo.gl/8tJOig http://goo.gl/8tJOig
- hokutosei 11y agoI'm not using rust for heavy/intense db/API stuffs currently w/Go. but in the future, i'm looking on using it as Main language for our API's. I like how safe it is and its explicitly.
- jinst8gmi 11y agoJust waiting for official Jetbrains/IntelliJ support...
- jedisct1 11y agoI'm still looking for an _easy_ way to write servers that can handle many TCP connections with Rust. The native thread/connection model quickly shows its limits, and is very slow on virtualized environments. mio is as low-level as libevent and just as painful to use. mioco and coio are very nice but blow the stack after 50k coroutines.
- posborne 11y agoIs there a good way to look up no_std crates? For crates written with no_std, is there a keyword we should be tagging things with? I have several crates providing access to GPIO/SPI/I2C under Linux and would like to put together a roadmap for having the interface to these types of devices that is portable to various platforms and devices (e.g. Linux as well as Zinc, ...).