17 ms·
Two years of Rust
- webkike 10y agoA few years ago I was a C evangelist. C++ was and more so now is a fine language with a lot of features I want. But Rust has that simplicity in a systems language that I crave that lets me do my own thing. That elegence. It's my favourite language by far. Keep it up!
- nickpsecurity 10y agoSimplicity? Modula-3 was simple, fast, and safe. PreScheme was less type-checked but powerful and simple. You can learn how to use them in a day coming from an imperative or functional language. Rust looks like it gives users extra power/safety with quite a bit of a learning curve (most say weeks to months) due to extra complexity. Definitely not simple, though. https://en.m.wikipedia.org/wiki/Modula-3 https://en.m.wikipedia.org/wiki/Modula-3 https://en.m.wikipedia.org/wiki/PreScheme https://en.m.wikipedia.org/wiki/PreScheme
- webkike 10y agoIt's definitely simpler than most other systems languages in what it gives you access too. Go, D, C++, C# are all far more complicated than Rust is. I would argue Modula-3 is not as simple because it contains a garbage collector - thus making the connection between written and compiled code less simple. Don't know much about pre scheme
- jabits 10y agoHave only checked Rust out a bit, but you mention C#. Does Rust have functionality similar to, and as easy to use, as Linq?
- zlynx 10y agoLinq, ick. It's a performance nightmare. No one knows what it is actually doing in the background so firstly, everyone writes horrible O-cubed performance with it, and then it is a series of random poking around to try fixing it.
- xorxornop 10y agoDepends if you're using it with ORMs or not. It's equally as useful with data in memory. Definitely slower for some things though (yes, it's always slower in one sense... But its also easier to make parallel, so it can even out in the end) Still, I now prefer doing such things in Rust.
- moosingin3space 10y agoIn Rust, you'd generally use functions that return iterators or Tokio's streams for Linq-style tasks. Check out the "Complex Queries" example on http://diesel.rs http://diesel.rs for an example of what a Linq-like library looks like in Rust.
- xorxornop 10y agoYes, it does. Also a C# programmer. I really like Rust. About as easy to use to transform, filter, group etc, but considerably faster.
- placeybordeaux 10y agoHow are you defining complexity in a programming language?
- webkike 10y agoI suppose it's the difference between the computational model presented by the language verses the computational model presented by the computer. A combination of how many components require some runtime environment to exist and how many disparate language features there are. Not an intuitive definition of simple for sure, but this is in the context of a system's programming language. In terms of just plain simple, I'd say scheme or just lambda calculus even takes the cake.
- placeybordeaux 10y agoSo the fact that that is a scheduler and a garbage collector in go means that by your definition even the simplest go program has a large complexity cost?
- webkike 10y agoNot necessarily large, but it factors into the mean complexity cost.
- comex 10y agoGo, at least, is far simpler as a language than Rust, and the implementation (compiler) is less complex overall, especially if you count LLVM on Rust's side. I suppose that Go programs exhibit more complex behavior at runtime due to the GC and green threads and stuff, but it's a huge stretch to call Go more complicated overall. On the other hand, I'd argue that Rust makes up for the complexity with performance, power (ability to express more complex programs in less code), and safety (not just memory safety, which Go also mostly guarantees, but the ability to leverage the type checker to verify code correctness in general). C++, on the other hand, is more complex (due to all the legacy drift), yet equal in performance, less safe, and less powerful in most respects (there are some things C++ can do that Rust can't, but more things for which the opposite applies).
- webkike 10y agoConsider how interfaces work and how you would have to implement them. Rust may have a more complicated type system and I suppose enums are more complicated in Rust, but the things I value as simple are more simple in Rust than Go.
- comex 10y agoWhat about interfaces? The basic idea of fat pointers with vtables works the same as Rust's trait objects. If you mean the ability to dynamically cast from one interface type to another, which Rust doesn't support - that does require a global list of implemented interfaces per type, but without generics that's not too hard to implement. (In Rust, it would be drastically more complex, verging on impossible to pull off with a good UX, due to various language features including wildcard impls, type-parameterized traits, and a Turing-complete type system.)
- webkike 10y agoWhen ever you would need to box a trait object in Rust Go automatically performs a heap allocation that is garbaged collected at some point. A bit more is explained here https://research.swtch.com/interfaces https://research.swtch.com/interfaces Basically there are some property of Go interfaces that make them far more dynamic than traits and implementations in Rust.
- pjmlp 10y agoThat is what the Assembly view of the compiler is for. Also your complaint can be applied to C as well. Given how optimizing compilers work, and the amount of UB being exploited, the language stoping being simple long time ago.
- cwzwarich 10y agoHow is Rust simpler? In terms of cognitive complexity on the part of the user, Modula-3 is much simpler; it is easier for a programmer to learn to write new Modula-3 code and correctly read Modula-3 code than it is for Rust code. In terms of implementation complexity, Modula-3 is also much simpler, despite the existence of a GC. A Modula-3 spec would be a great deal smaller than an equivalently detailed Rust spec. Many people have independently implemented Modula-3, whereas an independent implementation of Rust is effectively impossible, due to all of the unspecified implementation-defined behaviors. If you told me I had 1 year to implement either language from scratch, I would much rather choose Modula-3.
- steveklabnik 10y agoThere are two alternative implementations of Rust in the works; one is _almost_ able to compile rustc at this point.
- cwzwarich 10y agoWhat are these implementations? The one I immediately found by searching (https://github.com/thepowersgang/mrustc https://github.com/thepowersgang/mrustc) is accompanied by an explicit nongoal to correctly implement the language. It also doesn't seem particularly independent from rustc, given the similarities in implementation strategy and the fact that some parts look like rustc code converted to C++.
- steveklabnik 10y agoMrustc is one; my understanding is that it isn't yet, because its purpose in life is to make bootstrapping/ddc stuff easier. Once that works, I thought it intended to add the stuff that's missing. There's another that's not public.
- kibwen 10y ago> ddc stuff Note: this refers to "Diverse Double Compilation", which is a mitigation tactic against Reflections-on-Trusting-Trust attacks.
- nickpsecurity 10y agoModula-3, like many Wirth-inspired languages, can be described in a few pages with developers understanding those pages. You can be writing useful code in a day, using most of its features in a week, and probably master it in months to a year. The GC doesn't make it any less simple as that's one component that lets you ignore the complexity of memory management. The component itself can also be simple. Rust being simpler than other programming languages you cite actually means those languages are enormously complex. That is, given how much more complex Rust was to Wirth-style languages, Smalltalk, Scheme, and so on. It has extra stuff. Hence, the extra complexity. The compiler is also harder to write to make all that work.
- pjmlp 10y agoGiven the work being done in .NET Native and the planned features for C# 7.2, the language is starting to look like the spiritual descendent from Modula-3.
- kibwen 10y agoThe Modula-3 Evangelism Strike Force! We meet again! :)
- nickpsecurity 10y agoLol. While we're at it, I guess that makes Adacore and pals pushing Ada the Imperial Army, Ada Division given DOD background.
- Keyframe 10y agoAnd I was just about to preach Ada... ffs, man. We're not EVIL just because Death Star's OS is in Ada.
- nickpsecurity 10y agoRemember that little hole in the Death Star that blew the whole thing up? It was the C FFI. ;)
- nickpsecurity 10y agoOh yeah, I forgot to ask "Have you or the others considered rewriting your compiler in Modula-3? I hear you get safety, acceptable speed, and 5x iteration speed of Rust."
- lacampbell 10y agoI look forward to your fascinating re-implementation of unix tools from the 70s - only with less functionality.
- nickpsecurity 10y agoThat's what would happen lol.
- fizixer 10y agoLooking at Modula-3 wikipedia page, no thanks. (If it's case-sensitive, I don't want to switch to uppercase everytime I use the language keywords. If it's not case-sensitive, don't even get me started.) I had enough of that for a lifetime through FORTRAN, COBOL, SQL, BASIC, ASSEMBLY, etc. PreScheme sounds like an interesting idea.
- nickpsecurity 10y agoDo you have anything to say about it's feature set instead of just syntactic preference? As in, it's tradeoff in balancing complexity by what set of features?
- fizixer 10y agoLooking at it very briefly, its feature set is probably small enough to keep the language simple yet useful. To be clear, I'm not a Rust guy, or even C++, Go, D. On top of that, I'm a 2PL advocate (two programming languages). I think a combination of a readable high-level language like Python or Scheme, and a fast systems language like C, can carry out feats that no single programming language can as far as I know. (I don't consider keeping two or three programming language in your head while doing productive work a big deal, especially when learning multiple language is considered a beneficial thing).
- nickpsecurity 10y agoI'm with you on the 2PL right tool for the job idea. It's what I did. :)
- int_19h 10y agoIf I remember correctly, the only reason why Modula-3 is memory-safe is because it requires a GC. That right there is a no-go for a "C++ killer" system language.
- nickpsecurity 10y agoMost C++ apps can be written in a GC'd language. It has UNSAFE/SYSTEM for when you want to take chances managing your own memory. A language like Ada or Rust would be better at unsafe stuff.
- int_19h 10y agoYes, a lot of C++ code out there can be rewritten with GC. But for a language to replace C++, it has to cover the full spectrum, and that includes GC-less operation for low-level components. Providing primitives to manually allocate memory on unmanaged heap is not sufficient - the language must allow running without GC at all.
- nickpsecurity 10y agoIt does. It just isn't safe. The extra primitives for safer handling of pointers are main advantage of C++, D, Rust, etc. A worthwhile re-incarnagion of Modula-3 should have something similar.
- int_19h 10y agoSo the standard library doesn't rely on GC semantics anywhere? As I recall, that's the main problem with D: the standard library basically requires GC. Your code might not require it, but the library is always there. On top of that, it's just too easy to accidentally involve GC by using reference types.
- nickpsecurity 10y agoActually, I dont know. Good question. I tried to quickly get the info but all I found was about I/O. It's done UNSAFE to use platform-specific ways of reducing overhead. Probably no GC semantics there. Anyone curious who can get some Modula-3 source for stdlib might just look to see if UNSAFE is at the top of the routines. Also, if that turns off the GC, Id reason that just putting it in front of a stdlib function that was GC'd might make it work without it unless they screwed up memory management in the code itself.
- arwhatever 10y agoRust is a simple, intuitive language that just gets out of my way and lets me focus on solving the problem at hand.
- Kali909 10y agoI've only dabbled briefly in it and read various articles about the new features, but that hasn't been my very limited experience. The syntax and namespace constructs etc all look quite arcane to me, and then there's the borrow checker. Not sure I'd call it simple and intuitive (at least yet, for me).
- jmcomets 10y agoHaving written quite a bit of Rust, I agree with you that Rust is far from simple and not always as intuitive as say...Python or Ruby for example. However, I do appreciate the syntax which IMO is in that sweet spot between conciseness and expressiveness. Finally, the borrow checker is quite the experience. Whenever I banged my head trying to get some snippet to pass BCK, there was always an OH moment where I realized something was terribly wrong with my design. PS: Yes, there's still a few weird BCK false-positives. Hopefully we'll soon have non-lexical lifetimes[1] that should fix most issues. [1]: https://github.com/rust-lang/rust-roadmap/issues/16 https://github.com/rust-lang/rust-roadmap/issues/16
- arwhatever 10y agoI shouldn't joke like that - learning Rust was a 4-6 month long low point my my lifelong professional self-esteem. I think I'm coming out of it now, and am only continuing to use it Because Stockholm Syndrome. "No technology can ever be too arcane or complicated for the black t-shirt crowd." - Linus Torvalds
- brandur 10y agoI'm consistently blown away by just how good the project management for this language is. It's not just the forward progress that the language is making (which is considerable), but also just how well they package the information up into a form that the rest of us who are not involved day to day can digest, like has been done here. Another example is the "This Week in Rust" newsletter which takes progress that would've taken you hours to read about yourself, and puts it into a succinct format that you can get through in minutes [1]. The Rust 2017 roadmap which targeted forward movement on all the language's weakest features was admirable in itself, but even moreso is how much progress has already been made. In particular, I'm really excited about incremental compilation, which is showing as much as 5x speedups in early results [2]. I was also very happy to hear that the Rust team acknowledges that regardless of how performant they are, futures are not a particularly ergonomic or maintainable way to write code, and are considering what new constructs might look like over the longer term: > Over the rest of this year, we expect all of the above libraries to significantly mature; for a middleware ecosystem to sprout up; for the selection of supported protocols and services to grow; and, quite possibly, to tie all this all together with an async/await notation that works natively with Rust’s futures. I'm still on dabbling in Rust, but I'm fairly convinced that in another few years after this Tokio churn has gotten a chance to settle down and the async patterns are more broadly refined, there won't be many justifiable reasons to not write new projects in it, whether they're as low level as a Postgres extension, or as high level as a DB-backed HTTP application. It seems to have an almost perfect compromise between performance, safety, productivity, and ecosystem. [1] https://this-week-in-rust.org/ https://this-week-in-rust.org/ [2] https://blog.rust-lang.org/2017/05/15/rust-at-two-years.html#rust-should-have-a-pleasant-edit-compile-debug-cycle https://blog.rust-lang.org/2017/05/15/rust-at-two-years.html...
- FlyingSnake 10y agoAgreed. Rust is like a fresh breath of air, and the community around the language is a great example how an OpenSource project can work without being hostile to newcomers. Kudos to the Rust team!
- sillysaurus3 10y agoI'm still on dabbling in Rust, but I'm fairly convinced that in another few years after this Tokio churn has gotten a chance to settle down and the async patterns are more broadly refined, there won't be many justifiable reasons to not write new projects in it, whether they're as low level as a Postgres extension or as high level as a DB-backed HTTP application. Not being hindered by the compiler telling you what you can and can't do; freeing yourself from the write-compile-debug cycle, reducing it to repl-done; etc.
- kibwen 10y agoYet again allow me to shill for this year's Rust Community Survey, which closes June 12 and is open even to people who've never used Rust: https://blog.rust-lang.org/2017/05/03/survey.html https://blog.rust-lang.org/2017/05/03/survey.html (Yes, I know it's linked from the OP, but who reads that anyway?)
- simplehuman 10y agoThanks, just filled it now. I indeed managed to miss the survey link when reading the post.
- dmix 10y agoI thought that was strange survey at first, as there were very few questions related to programming and coding with Rust but plenty of questions around engaging with the community (inclusiveness/comfort level, conference attendance, etc). But then I realized it was a "Rust Community Survey". Is there another survey more suited to use Rust as a language ala "State of Clojure"? I don't use Clojure anymore but I still love reading these every year to keep up to date with the progress it's making. For ex: http://blog.cognitect.com/blog/2017/1/31/state-of-clojure-2016-results http://blog.cognitect.com/blog/2017/1/31/state-of-clojure-20... Edit: Oh nevermind, it seems the questions change if you select 'Yes' or 'No' at the beginning for "still using Rust". I didn't totally stop using Rust I just spent time learning it, experimenting on some projects, but I don't have a day-to-day need for it - not sure if either possible answer applied to me.
- rolfvandekrol 10y agoA 2.4MB image is bit overkill, isn't it?
- mastax 10y agoYou're right, I'll go fix it. Edit: fixed.
- mmstick 10y agoYou might like to know that I've had great success with full stack web development using Rust. My website (https://mmstick.tk https://mmstick.tk) is hosted with the Rocket (https://rocket.rs/overview/ https://rocket.rs/overview/) web framework and operates as a fully static binary with 100% Rust code. I've even got HTTPS and Brotli compression.
- executesorder66 10y agoI get a message that says, "Your web browser does not support Brotli, and therefore is not supported. Report this as a bug to your web browser vendor." I am using Firefox 53.02 on Linux, and my browser is sending this request header: Accept-Encoding: gzip, deflate, br As far as I know Firefox fully supports brotli compression. Any idea what is wrong?
- Terribledactyl 10y agoI'm having a bit of an issue with your site in Safari. 10.12.4 sierra, extensions turned off. https://s2.postimg.org/4t8v7lqdl/Screen_Shot_2017-05-15_at_1.57.48_PM.png https://s2.postimg.org/4t8v7lqdl/Screen_Shot_2017-05-15_at_1...
- mmstick 10y agoYou need a web browser that supports Brotli compression -- the standard compression algorithm for HTTPS. Safari does not support it, but everyone else does. Even Edge. http://caniuse.com/#feat=brotli http://caniuse.com/#feat=brotli
- detaro 10y ago> the standard compression algorithm for HTTPS That's utter nonsense.
- mmstick 10y agoAll vendors do not support Brotli compression with the HTTP protocol. Brotli is only supported when accessing a site through HTTPS. Moreover, as Brotli compresses and decompresses faster than Gzip, whilst simultaneously producing smaller file sizes, there is no point in using anything other than Brotli for HTTPS website. Hence, it's the standard compression algorithm for HTTPS. All web vendors support Brotli w/ HTTPS, except Apple's WebKit. Simple.
- Animats 10y agoThe success stories are Mozilla's Servo, Dropbox's client and back end, and parts of Gnome. That's good. It's interesting that all the success stories involve mixing Rust and C/C++ code. Are there any pure Rust successes yet?
- cyphar 10y agoI was under the impression that Mozilla Servo is entirely written in Rust (GitHub appears to not be able to run linguist on the repo at the moment, the language detection isn't showing up).
- Manishearth 10y agoWe use some C/++ components (the JS engine is purely C++, and we bind to various C/++ libraries for things like graphics. We don't have the resources to rewrite everything). All the interesting bits are Rust :)
- Ar-Curunir 10y agoRipgrep, a file searching tool written entirely in Rust, was recently deployed in Visual Studio Code.
- valarauca1 10y agoAlacrity is insanely fast OpenGL terminal emulator [1]. I use as my semi-daily driver for most VIM'ing AgiData built a MySQL proxy [2] out of it... They manage sharding MySQL servers for enterprises. They claim their working it into production. [1] https://github.com/jwilm/alacritty https://github.com/jwilm/alacritty [2] http://www.agildata.com/building-scalable-mysql-proxy-rust/ http://www.agildata.com/building-scalable-mysql-proxy-rust/
- Manishearth 10y agoThe dropbox stuff isn't a mix of Rust and C/C++, it's a mix of Rust and Go[1]. (Dropbox has a variety of things using Rust, and IIRC some of them are pure Rust. I don't remember the details.) [1]: https://news.ycombinator.com/item?id=11283758 https://news.ycombinator.com/item?id=11283758
- shmerl 10y agoNice to see a lot additions to the Rust Book (v2). Like on OOP features for example.
- lelandbatey 10y agoI'm really excited by the new edition of the rust book mentioned in the post, from a brief look it seems that it covers all the areas I felt most needed improvement (for example what does a "move" mean?, a concept completely omitted from the first edition). Also, I want to plug just how fun Rust is to write once you begin to learn how it works. It's totally awesome to write fast code that doesn't segfault, especially when it comes to things where tooling in other languages is lacking, such as doing parallel data processing. Speaking of which, I'll shamelessly plug some recent results from a Buddhabrot[0] renderer I wrote[1] in Rust: http://lelandbatey.com/projects/buddhabrot/3k--mellowish-fractal2017-05-14_14:01:47.png http://lelandbatey.com/projects/buddhabrot/3k--mellowish-fra... [0] - https://en.wikipedia.org/wiki/Buddhabrot https://en.wikipedia.org/wiki/Buddhabrot [1] - https://github.com/lelandbatey/rust_buddhabrot/ https://github.com/lelandbatey/rust_buddhabrot/
- breerly 10y agoCurious, since I haven't been following closely - is Tokio fit for both IO and CPU-bound work, or do you need to break into threads? I use Golang daily, and have been spoiled by the opinionated approach taken to solving both CPU and IO-bound workloads.
- steveklabnik 10y agoIn one sense, IO, and in another sense, both; that is, what you do there is use futures-cpupool, which is a threadpool with a futures interface. So it still all composes just fine.
- progman 10y agoCongratulations to the Rust team for the great work! The impact of Rust on the programming safety community has grown so big that even hardcore Ada developers are getting really nervous about Rust's powerful competition. https://groups.google.com/forum/#!topic/comp.lang.ada/H35QcYiWR1Y https://groups.google.com/forum/#!topic/comp.lang.ada/H35QcY... Although Nim and Lisp are still more productive than Rust for my use cases -- Rust really needs a convenient edit-compile-debug cycle, and also an easy bootstrap from source mechanism -- I am watching Rust's development with pleasure. I am pretty convinced that within the next ten years Rust will not only cause a serious decline of C++ but also eat a big portion from Ada's lunch in safety critical applications.