News for hackers. Stuff that matters.
Re:Uber Go Style Guide by twic on Friday October 11, 2019 @03:59PM (#21227867)
No, the point of this observation is that Go exposes this complexity, it just doesn't make it explicit.
Re:Uber Go Style Guide by dpc_pw on Friday October 11, 2019 @04:13PM (#21228023)
Exactly. Ownership/lifetimes exist in almost every mainstream PL (anywhere where you can have any sort of references + mutability). It's just people pretend it doesn't, and hope everything is going to be fine. And when you bring it in front of their consciousness they scream in panic, like it didn't exist before. Once you internalize Rust ownership rules, they are almost effortless and you see and obey them in any code in any PL you happen to be programming in.
Re:Uber Go Style Guide by weberc2 on Friday October 11, 2019 @09:18PM (#21229870)
Most languages have a GC so there really is no ownership to pretend away (if you like, everything is owned by the GC). Rust can be super cool without inventing fake problems for other languages.
Re:Uber Go Style Guide by dpc_pw on Saturday October 12, 2019 @12:09AM (#21230612)
I'm sorry, but that is a naive misconception. "everything is owned by the GC" is a sign of not understanding concept of ownership, BTW. GC is not an actor in the system, so does not participate in the ownership. A Java finalizers might kind of do stuff, but that's when all references are gone, so they have exclusive ownership.

Anyway... Languages with GC still do have ownership. It is just defaulting to be the most problematic case of "shared ownership" everywhere. Shared ownership is only worry-free if you don't ever modify data. Which is possible, but actually harder and more constraining to implement in a practical software (especially if you care about any performance). So then you either have to synchronize everything with mutexes, and figure out a way to not deadlock yourself on every step (also hard), or you have to implicitly track ownership and decide who can and when mutate the data, which is exactly what Rust would make you do, but this time you get no compiler help. The only reason people don't notice that is because they do it incorrectly and it works most of the time, so they are unaware.

There is no escape from it - one has to figure out ownership with a GC or without it, because GC has nothing to do with ownership. It only reclaims memory after all references are gone. That's it. That is actually very, very little improvement.

Re:Uber Go Style Guide by blub on Saturday October 12, 2019 @04:15AM (#21231437)
"The only reason people don't notice that is because they do it incorrectly and it works most of the time, so they are unaware."

Ironically, that's Rust biggest problem: not using perfect ownership management works for most software most of the time and that's good enough for most people and companies.

You probably can't sell ownership management as a feature. The only thing that Rust can sell and that makes sense is "it won't crash" + "it's fast", but then there's a lot of other languages that have the first property and the second is not very appreciated, as seen in the rise of so-called Electron apps and web apps in general.

Re:Uber Go Style Guide by dpc_pw on Saturday October 12, 2019 @09:00PM (#21237509)
Sure. SWE is not a first industry where you can get away with cutting corners or straight incompetence. And some people are going to write a code taking care of ownership by experience, skill, etc. and they don't need Rust. They might not know they are taking care of ownership, and yet do it correctly. Rust is only formalizing and verifying it.

I think in time more and more people and teams will discover that doing stuff with Rust is just cheaper and more productive. You learn ownership once, you get great results ever after.

Re:Uber Go Style Guide by weberc2 on Saturday October 12, 2019 @08:10AM (#21232412)
Ok, then educate me—what is ownership if not the responsibility for managing (cleaning up) a resource? In my C and C++ days, I never heard of it refer to some kind of exclusive permission to mutate a resource (which seems to be your meaning), but rather as the responsibility to free the resource (as in “the owner must and only the owner _can_ free the owner resource”).

It seems likely that you and I are using different definitions, and yours Rust-specific (and therefore not meaningfully generalizable to other languages, especially those with GC).

Re:Uber Go Style Guide by twic on Saturday October 12, 2019 @02:54PM (#21235357)
Ownership is (at least) two things: who has the responsibility for destroying an object when it's finished with, which GC takes care of, and who has the right to mutate an object while it's alive, which GC doesn't.

I mostly write Java for a living, have done for a decade, and still occasionally trip myself up by mutating an object I'd forgotten I've shared.

Re:Uber Go Style Guide by steveklabnik on Saturday October 12, 2019 @10:58AM (#21233640)
In Rust, we also say that it’s the right to destroy.
Re:Uber Go Style Guide by weberc2 on Saturday October 12, 2019 @01:14PM (#21234637)
Thanks for responding, Steve. I understand that “ownership” implies the right to destroy in any language. The bit I’m not so clear about is whether or not there are other rights/responsibilities (such as the right to mutate) as the OP suggests and whether a definition that includes those rights/responsibilities can meaningfully apply to any language or just Rust.
Re:Uber Go Style Guide by steveklabnik on Saturday October 12, 2019 @10:22PM (#21237865)
I think they’re talking about the borrow checker, which is technically distinct from ownership.
Re:Uber Go Style Guide by sanxiyn on Friday October 11, 2019 @10:13PM (#21230155)
How is it a fake problem? Uber is copying slices it doesn't need to copy, suffering significant performance penalty, because it is too error prone in Go. Rust completely prevents this error.
Re:Uber Go Style Guide by grumpydba on Saturday October 12, 2019 @01:46AM (#21230946)
It's a trade-off. Programmer's productivity versus theorically perfect ownership handling.

I think that rust fills the needs of applications with extreme requirements. A browser is in that niche. Not all software is.

Thus most of the time you don't have to inflict yourself the pain to work with it.

Re:Uber Go Style Guide by weberc2 on Friday October 11, 2019 @10:34PM (#21230251)
Ownership is different than mutability. Yes, immutability would prevent those errors.
Re:Uber Go Style Guide by rictic on Saturday October 12, 2019 @12:03AM (#21230582)
The point is that ownership also prevents these errors. If there are never two simultaneous mutable references to something, then you can get the advantages of immutable data structures without paying the performance penalty.
Re:Uber Go Style Guide by weberc2 on Sunday October 13, 2019 @09:21AM (#21240213)
We’re having a semantic debate. Ownership appears to mean something different to Rust folks, which is fine. I agree that Rust’s borrow checker (what you appear to be referring to as ownership or the enforcer thereof) prevents errors and is generally very cool. It’s just not what I understand ownership to mean.
Re:Uber Go Style Guide by tptacek on Friday October 11, 2019 @05:29PM (#21228653)
Language fight! Definitely I think that's a good discussion to promote on a thread about _a style guide for a language_!
Re:Uber Go Style Guide by twic on Saturday October 12, 2019 @02:56PM (#21235368)
Language fights are of the things many of us enjoy most about HN. Would you go to a metal show and complain about the moshpit? Just stand safely to one side and enjoy the vibe, man.
Re:Uber Go Style Guide by eternalban on Friday October 11, 2019 @08:01PM (#21229484)
I think this is where Rob Pike got it backwards (in terms of one of his stated goal for Go).

Go is a very effective tool in the hands of experienced programmers, without having to pay the cognitive load price of 'Mommy' languages. I am reminded of Bryan Cantrill's rant regarding threads in this context.

Writing solid software is hard. It takes skill, experience, and serious battle scars. Tools and languages can help, but at the end of the day, it comes down to the team that writes the code.

Re:Uber Go Style Guide by ummonk on Friday October 11, 2019 @10:36PM (#21230258)
Even the most experienced programmer can’t hold all of a million line codebase in his or her head. And that is the issue with a language like Go - you can be careful about the code you write but it doesn’t have static analysis enforceable constraints on code other people write that interacts with your code / data.
Re:Uber Go Style Guide by eternalban on Saturday October 12, 2019 @05:18AM (#21231684)
That is a seriously ridiculous proposition in my opinion. If you find yourself involved in a project that requires you to hold a "million" lines of code in your head, refer to above point I made regarding "team". Something has gone seriously wrong somewhere if that is the situation.

This should not be news to this audience on HN: proper software architecture, design, and development processes trump "language" any day, any time, any planet. Conversely, even the most 'profoundly correct' language in the hands of unprepared development teams can result in software disasters.

The human factor is still paramount in software development. That is my experience after decades in this profession and is not mere conjecture.