News for hackers. Stuff that matters.
Re:Proposal: Go 2 transition by rhodysurf on Friday October 26, 2018 @04:06PM (#18312343)
So I am a C++ dev by day and I write some go and rust for side projects or smaller projects at work. Go is SOOOOOO much simpler to write (unless you get into crazy threading data race stuff) than rust. I like rust (a lot), but the mental load is a lot more to take on than go.
Re:Proposal: Go 2 transition by steveklabnik on Friday October 26, 2018 @04:12PM (#18312378)
An interesting comparison between experiences is that people describe Rust as having a lot of mental load at first, but eventually as having way less, since the compiler does so much for you.

On the topic of the original thread, I wonder why Rust wasn’t included; maybe it’s because our first release that’s achieving similar goals is happening six weeks from now, and they wanted to see how things played out in practice, not in theory.

Re:Proposal: Go 2 transition by rhodysurf on Friday October 26, 2018 @04:19PM (#18312431)
Yeah I agree that as I learned rust I got used to it and became slowly more productive. But I am still nowhere near as fast to accomplish things with it as I am with modern C++ or go or swift.
Re:Proposal: Go 2 transition by Scarbutt on Friday October 26, 2018 @05:04PM (#18312688)
people describe Rust as having a lot of mental load at first, but eventually as having way less.

Well that's true for most not-so-semi-trivial stuff one has to learn, it doesn't mean is always a good idea though.

Just giving a different perspective to beginners.

Re:Proposal: Go 2 transition by steveklabnik on Friday October 26, 2018 @05:10PM (#18312718)
Sure! You should use whatever tools you prefer. Rust isn’t the best programming language of all times, it has pros and cons like everything else.
Re:Proposal: Go 2 transition by apta on Friday October 26, 2018 @11:47PM (#18314250)
> maybe it’s because our first release that’s achieving similar goals is happening six weeks from now

What's happening in the next release? Any backward compatible breaking changes?

Re:Proposal: Go 2 transition by steveklabnik on Saturday October 27, 2018 @03:02AM (#18314669)
Re:Proposal: Go 2 transition by Quekid5 on Friday October 26, 2018 @04:23PM (#18312457)
Yes, but it's also much more likely to result in a run-time failure. I'm not talking about memory safety here -- just the fact that Rust has (Algebraic Data)/Sum Types[1]. Of course these kind of "want" pattern matching, but it's not an absolute requirement.

Having ADTs/Sum types will improve the reliability of your software immensely just by being available. It's truly absurd just how much work they can do: They can replace "null", they can ensure that there are no surprises in a state machine where some state carries over unexpectedly, etc. etc.

[1] Not higher-kinded, but that's probably a distraction for the point I'm making.

Re:Proposal: Go 2 transition by rhodysurf on Friday October 26, 2018 @04:33PM (#18312510)
Yes I know. I love Sum types, and I love Trait oriented programming. And I definitely miss sum types in Go and C++. If C++ had sum types and no header files that would probably hit my (very subjective) sweetspot.

Tangent: I wish Rust had optional chaining like swift, which I know is a limitation due to Option just being a normal sum type. Having to pattern match every optional is burdensome

Re:Proposal: Go 2 transition by Quekid5 on Friday October 26, 2018 @04:37PM (#18312534)
Heh, I was actually alluding to C++ with the pattern matching thing. Std::variant<> is actually a bona fide sum type, but using it is horrendous because of the lack of pattern matching. You can use the the "cppreference overloaded"[1] trick to sort-of do basic pattern matching of the outer constructor, but it's still not particularly well supported by compilers.

[1] I'm using this as a proxy name for a trick I saw on cppreference where you can (via template tricks, why not?) write code very similar to pattern matching, but it's ultimately quite simplistic and brittle.

Re:Proposal: Go 2 transition by rhodysurf on Friday October 26, 2018 @04:41PM (#18312560)
Ahhh ok I gotcha now. To be honest I have not used std::variant yet as I am stuck on C++11 at work. I agree though at some point there is a limitation with no pattern matching like you have in rust
Re:Proposal: Go 2 transition by ilovecaching on Friday October 26, 2018 @04:25PM (#18312467)
Agreed. You could encode valid state transitions phantom types, for example. Go's weaker type system means it has less power to encode was is and is not correct program behavior.
Re:Proposal: Go 2 transition by ilovecaching on Friday October 26, 2018 @04:14PM (#18312394)
I've found that Go works well for small code bases where duplication isn't too much of a worry. It makes sense. The authors of Go are the same people who advocate for small, focused tools: the unix philosophy.

When you grow to a certain size though, it becomes very messy. Go has very little facility for abstraction despite being a higher level language with a GC and a substantial runtime. I also personally find the error handling frustrating. Most of the time all you want to do with an error is send it to the caller, who has more context on how to handle it.

I still write Go alongside Rust, but I use it as a scripting language, for all the things I used to use Python for. Rust just has the tools I need to build abstractions, and lets me avoid continually rewriting data structures.

Re:Proposal: Go 2 transition by deckarep on Friday October 26, 2018 @04:32PM (#18312502)
Yes there is much more mental load you pay upfront during development but once you get code working and satisfy the borrow checker you now have significantly stronger runtime guarantees about your application in terms of safe and proper concurrency.

This is the trade off.

Re:Proposal: Go 2 transition by rhodysurf on Friday October 26, 2018 @04:34PM (#18312521)
I understand that, I posted my response becasue the OC was presenting Rust as a replacement for Go but they are very different languages with different tradeoffs
Re:Proposal: Go 2 transition by ilovecaching on Friday October 26, 2018 @04:47PM (#18312595)
Actually, the Go team even bills Go as a systems language. I think if you're going to consider Go, you should also consider what you could get with Rust.

Sure the upfront investment in Rust higher, Go is almost too small, but the upfront cost of Rust is amortized via the hours you save with all the abstractions and performance you get right out of the box.

Re:Proposal: Go 2 transition by steveklabnik on Friday October 26, 2018 @04:59PM (#18312665)
They’ve moved away from “systems” as a moniker, and Rust slowly is too.

It’s just too confusing of a term these days, and nobody knows what it actually means, so it’s not useful.

Re:Proposal: Go 2 transition by pjmlp on Saturday October 27, 2018 @07:38AM (#18315311)
I would say if one can write OSes, device drivers, debuggers, compilers, target bare metal deployments on language X, then it is a systems language, regardless of what label people put on it.
Re:Proposal: Go 2 transition by pvg on Saturday October 27, 2018 @11:07AM (#18316024)
The problem with that is it's a narrowing of the 'historical' use of the term and just confuses things further. The Go (and now Rust, it seems) people are right to move away from it.
Re:Proposal: Go 2 transition by kjeetgill on Saturday October 27, 2018 @02:28PM (#18316999)
Even when Go started and used the term I don't think this is what they meant by it.
Re:Proposal: Go 2 transition by pjmlp on Saturday October 27, 2018 @04:48PM (#18317592)
Well given its use in Fucshia TCP/IP stack, file system management tooling, Android GPU debugger, not everyone at Google thinks like that.

Likewise those universities doing OS research in Go, submitting their findings to USENIX.

Re:Proposal: Go 2 transition by zbentley on Friday October 26, 2018 @05:37PM (#18312893)
> you now have significantly stronger runtime guarantees about your application in terms of safe and proper concurrency.

I agree, but I think many people assume that this is the only benefit achieved. The presence of the borrow checker and rigorous memory safety requirements allows the compiler to take substantially more advantageous paths in allocation/deallocation compared to e.g. C. The benefit attained is similar to the benefit of switching from C to very well memory-managed C++, except it comes by default.

This is a significant advantage even in code that is not concurrent at all. I feel like it's a shortcoming of Rust's marketing, if anything, that the safety restrictions are often pitched only in context of thread-safety rather than memory-usage-optimization.

Re:Proposal: Go 2 transition by deckarep on Friday October 26, 2018 @06:13PM (#18313067)
Yes I agree with those points as well...because Rust is now able to statically have such guarantees, this additional knowledge allows for some great optimizations under the good.