News for hackers. Stuff that matters.
Re:Announcing Rust 1.2 by pcwalton on Friday August 07, 2015 @01:54PM (#10023875)
If you're using C and encountering memory safety problems, however, then you may want to consider Rust. Moving to C++ from C offers a small safety benefit and a large expressiveness benefit at the cost of a very large complexity drawback. Moving to Rust from C, on the other hand, offers a large safety benefit and a large expressiveness benefit at the cost of a significant complexity drawback. (I think Rust as a language is less complex than C++, and the complexity of C/C++ undefined behavior rules completely vanishes in safe Rust.)
Re:Announcing Rust 1.2 by dlanouette on Friday August 07, 2015 @02:20PM (#10024038)
Can you elaborate on what you mean by the "very large/significant complexity drawback"? From what I've seen (which is admittedly small) Rust is much less complex than either C or C++.
Re:Announcing Rust 1.2 by pcwalton on Friday August 07, 2015 @02:38PM (#10024157)
Compared to C, Rust has generics, closures, a module system, hygienic macros, real strings, slices, lifetimes, and the borrow checker. But note that all the features that Rust adds over C are, in my view, one of (a) necessary for memory safety (which is an important feature in 2015); (b) improvements on C features (macros compared to cpp, strings compared to char *, modules compared to #include); (c) things you expect from a modern language (generics, closures).
Re:Announcing Rust 1.2 by JoshTriplett on Friday August 07, 2015 @02:34PM (#10024134)
Rust is a larger language than C, though far smaller than C++. More importantly, with Rust you should expect to spend more of your time convincing the compiler that you've written correct code, which requires a reasonable understanding of Rust semantics. (The compiler makes that fairly easy, but it can still be a bit of a shock when you're staring at code that seems obviously correct to you but the compiler has no way to know that.)

On the other hand, once you do convince the compiler, you have an excellent chance that the code actually is correct, and you'll spend far less time chasing down crazy runtime bugs.

Re:Announcing Rust 1.2 by selestify on Friday August 07, 2015 @06:38PM (#10025436)
> On the other hand, once you do convince the compiler, you have an excellent chance that the code actually is correct, and you'll spend far less time chasing down crazy runtime bugs.

That's what I love about Haskell as well. Know of any other languages like this?

Re:Announcing Rust 1.2 by JoshTriplett on Friday August 07, 2015 @06:56PM (#10025485)
I used to feel more strongly that way about Haskell. I still do about most types of errors, but I spent a long time debugging serious performance issues caused by unbounded laziness and insufficient strictness.

In general, I'm a big fan of static typing. I don't know any other language that manages to provide as much static memory safety as Rust, though; that's the main innovation in Rust.

Re:Announcing Rust 1.2 by gue5t on Friday August 07, 2015 @10:52PM (#10026154)
The difficulty of reasoning about strictness and memory consumption in Haskell is by far its biggest flaw. This is why I stopped writing Haskell: even if you understand your own code perfectly, you can't tell how well-behaved it will be without reading your dependencies and all their dependencies.

And yet strictness typing seems to be on nobody's plan for future Haskell extensions.

Re:Announcing Rust 1.2 by ivoras on Friday August 07, 2015 @03:49PM (#10024594)
I'd say that Go is a better "better C" than Rust, for already functional C programmers. The syntax of Go is as removed from C as Rust's, and it's more mature.

TBH, Rust looks a bit stillborn - too weird to live, too rare to die.

Re:Announcing Rust 1.2 by MichaelGG on Friday August 07, 2015 @04:40PM (#10024877)
People say this. I looked into Go, to write modules for VoIP platforms. Go is a managed runtime environment. I can't drop it in where I'm currently using C. I can't easily start migrating pieces of a program to Go. But Rust does execute exactly where C can.

In fact, I don't see how Go is C like at all. It seems much more akin to other managed languages, like Java. The only reason it seems to come up in these discussions is that Google said it was for "systems" programming, using a new value of "systems".

Maybe you're referring to mindsets and syntax or something?

Re:Announcing Rust 1.2 by loudmax on Friday August 07, 2015 @05:00PM (#10024990)
I strongly disagree with this assessment. Go may be a better Java or Python, but as a GC'd language it's not in the same league as C or C++ or Rust.

I also happen to prefer Go's syntax to Rust's, but I can live with GC'd performance. If I were writing something as performance critical as a browser rendering engine, I could get past the weird syntax. I think both Go and Rust have bright futures.

Re:Announcing Rust 1.2 by steveklabnik on Friday August 07, 2015 @04:09PM (#10024689)
This is also why it matters to know what you mean by C: to me, a key aspect of C is the manual memory management and lack of a runtime. A C that adds GC is no longer C.
Re:Announcing Rust 1.2 by dragonwriter on Friday August 07, 2015 @08:08PM (#10025761)
Go is more mature than Rust, and to the extent that they have similar advantages (which I don't think is very much) Go's first-mover advantage may help it.

OTOH, Rust is maturing quite well, and I think it has broader applicability and a very different area that is its strongest point that is the case for Go, so I think that its quite likely to do well initially in places where Go isn't much of a competitor, and in the long run may well be more successful than Go. (Particularly, its focus seems to be aimed at lower-level system programming than Go's, but a the same time it has constructs that, once good low-level libraries are in place, seem to make it potentially quite good for higher-level programming as well.)

Re:Announcing Rust 1.2 by baq on Friday August 07, 2015 @05:42PM (#10025181)
comparing go to c is like comparing python to c - those langauges are designed for different purposes. if you're happily delivering web services with go, stay with go, rust probably is not for you. if you OTOH don't want a GC or want to write a dll that you can then call via FFI from go/python/ruby, rust is the way to go, as is C or C++ (pretty much the only other choices available).
Re:Announcing Rust 1.2 by pekk on Friday August 07, 2015 @08:00PM (#10025735)
Go isn't designed for the same purposes as Python or Ruby, either. It's statically typed and far less expressive.
Re:Announcing Rust 1.2 by baq on Monday August 10, 2015 @07:50AM (#10033925)
indeed there are critical differences regarding certain details like compilation to executables, compile-time time checking, etc. this doesn't mean the purpose can't be the same. it certainly is for many people (developing web sites).
Re:Announcing Rust 1.2 by pcwalton on Friday August 07, 2015 @06:18PM (#10025357)
Do you have specific reasons why Go is a better "better C" than Rust?
Re:Announcing Rust 1.2 by nnethercote on Friday August 07, 2015 @07:43PM (#10025678)
> too weird to live, too rare to die.

I disagree with "too weird to live" but at least it makes sense. What does "too rare to die" mean?

Re:Announcing Rust 1.2 by AprilArcus on Sunday August 09, 2015 @12:51PM (#10030678)