News for hackers. Stuff that matters.
Re:Rust via its Core Values by kajecounterhack on Sunday April 03, 2016 @05:35PM (#11417878)

  I see the appeal of it for big enterprise teams composed of   
  disposable programmers
Can you explain? Why are go programmers "disposable?"

Is it because the code is understandable (especially following our style guide / enforcing gofmt, godoc, etc)? I do find our go code to be that way, but I don't think that's a bad thing.

  Productivity in Go is an illusion
I feel productive in Go. Can you explain this statement? I like dealing with a simpler toolchain as the op mentioned.
Re:Rust via its Core Values by glennsl on Sunday April 03, 2016 @06:45PM (#11418166)
I'm not the parent, but my impression is that Go is productive more in the sense of quantity than quality. It is easy to pick up, understand and use. But it is also very error prone, because its type system is poorly suited for proper error handling, nulls and generic code. It's certainly better than C and most dynamic languages, but that's not setting the bar very high.

I really see no reason to pick up Go these days unless you're a fan of 80s retro hits. If you want most of the goodness of Rust combined with the easiness of Go, look to Kotlin and Swift.

Re:Rust via its Core Values by kajecounterhack on Sunday April 03, 2016 @09:42PM (#11418874)

  It's certainly better than C and most dynamic languages, 
  but that's not setting the bar very high.
I'm not sure I agree with that sentiment; C and dynamic languages are used in important applications and being better than them for the same tasks does seem to be a design goal of go. I personally feel that it accomplishes this in a number of areas.

  It is easy to pick up, understand, and use.
This is true and I think it's a huge benefit.

  But it is also very error prone, because its type system 
  is poorly suited for proper error handling, nulls and 
  generic code
That's your opinion. It's less safe than rust, more safe than python. I think it has a rather large niche. I personally like interfaces and that idiomatic golang testing uses language primitives.

It's weird to me that people compare Go and Rust, they're languages with very different motivations.

Re:Rust via its Core Values by glennsl on Monday April 04, 2016 @08:58AM (#11421490)
> C and dynamic languages are used in important applications and being better than them for the same tasks does seem to be a design goal of go

C is essentially popular because it's popular. And it therefore has a huge ecosystem, can run on pretty much anything and has tons of code already written. That's a huge benefit, and one that Go does not have because it hasn't existed as the dominant language for 45 years yet.

Popular dynamic languages have the benefit of being toys with the bare minimum of features needed to scale beyond toy programs. You can build a house with legos too. It won't be a good house, and it won't be very cost-effective, but it's certainly possible.

> That's your opinion.

No, it's not just my opinion. A well-designed type system eliminates the possibility of you making certain types of very common errors. It will refuse to allow you, and it will sometimes even help you understand why, and what you should have done instead.

The complexity of Rust comes mostly from how the type system has been designed to handle manual memory management. If you take that part out and replace it with garbage collection, you'll get a language that is both safe and easy to learn and understand. Not quite as safe as Rust, and not quite as simple as Go, but very close in both regards. Languages like this do exist. See Kotlin and Swift, for example.

> It's weird to me that people compare Go and Rust, they're languages with very different motivations.

In this we agree. And I'm not arguing for Rust as a substitute for Go. But I am arguing for ignoring a language that ignores much of what the rest of us have learnt about type systems and programming languages during the past half a century (in real years, not tech years).

Re:Rust via its Core Values by smitherfield on Monday April 04, 2016 @01:44PM (#11423789)
Swift isn't garbage collected. (Allocation and deallocation code is handled by the compiler).
Re:Rust via its Core Values by steveklabnik on Monday April 04, 2016 @02:41PM (#11424254)
Depending on who you talk to, reference counting is garbage collection. Industry tends to mean "tracing GC" when they say GC, academia tends to mean "all runtime automatic memory management schemes".
Re:Rust via its Core Values by smitherfield on Monday April 04, 2016 @06:38PM (#11426308)
I might be totally off-base, since unlike you I have no background in compilers, language runtimes etc, but I was under the impression that Swift's ARC is compile-time, which would make it not GC'ed by either of your definitions, whereas runtime ARC, like PHP's implementation, would fit the second.
Re:Rust via its Core Values by steveklabnik on Monday April 04, 2016 @06:51PM (#11426377)
It's all good! This is a very subtle difference.

So, imagine an interface to a reference counted thing. You have two methods:

  rc.add()
  rc.subtract()
Add bumps the count, subtract drops the count down. When the count hits zero, the thing is deallocated.

What Swift's _automatic_ reference counting is insert the calls to add/subtract _for you_, so that you don't need to do it. But fundamentally, they're still there. So the decision of "when does this get deallocated" is still a runtime thing, even though those calls are compiler inserted.

Does that make sense? Here's another reference: http://stackoverflow.com/questions/6385212/how-does-the-new-...

Re:Rust via its Core Values by smitherfield on Monday April 04, 2016 @07:20PM (#11426561)
Thanks for the info, and for the very clear explanation!

Obviously, even in C the memory management is a high-level runtime abstraction of sorts (neither the programmer nor the compiler is choosing the actual addresses in memory to alloc/dealloc), so at what point on the continuum of C++-style RAII, Obj-C RC, Swift ARC and so on would you say "garbage collection" comes into play? Is it just one of those "I know it when I see it" type things?

Re:Rust via its Core Values by steveklabnik on Monday April 04, 2016 @07:28PM (#11426609)
Any time :)

So, one of the reasons this is a bit muddy is that historically speaking, it was much more clear. You had languages which did some kind of "automatic" memory management, if that was through a refcount system of some kind (Like Python was (is?)), or a tracing GC (like Lisp was/is, or Ruby, whatever). And then you had languages which had some sort of "manual" memory management, where you explicitly allocate and free heap memory. I think that the real distinction here is "does runtime state decide if something gets deallocated"? If so, then that's garbage collected. If not, then it's "manual".

But languages like Rust and Swift sort of bend this, and I see them as coming from each side, looking in. So Swift is like a GC'd language that's not _quite_ GC'd, while Rust is like a manually managed language that's not _quite_ manually managed. They feel a bit different.

Re:Rust via its Core Values by smitherfield on Monday April 04, 2016 @07:54PM (#11426737)
Thanks again; very interesting stuff, and I feel like my understanding of the concept here is quite a bit better now. It'd make a good blog post, I think. (I'm probably the only person seeing this convo).

It's a great skill to be able to explain pretty complex topics in "layman's" terms; I don't think I'm alone in having the experience of posing a question to an expert, getting a jargon-heavy answer that takes 30min of Googling to parse (or a condescending one that assumes I'm unfamiliar with basic CS concepts), and left feeling foolish for asking. So kudos to you! :)

Re:Rust via its Core Values by steveklabnik on Monday April 04, 2016 @07:59PM (#11426757)
Thanks! I've worked very hard at it; it's why my job is docs :) Have a great night (or whatever your time zone is)!
Re:Rust via its Core Values by smitherfield on Monday April 04, 2016 @09:08PM (#11427062)
Good guess; EDT here/Boston. :) You too!
Re:Rust via its Core Values by steveklabnik on Monday April 04, 2016 @09:28PM (#11427136)
Brooklyn here. I may show up at the Boston Rust meetup over the next few months!
Re:Rust via its Core Values by catnaroek on Sunday April 03, 2016 @06:57PM (#11418220)
> It is easy to pick up, understand and use. But it is also very error prone

These two sentences are badly in conflict. How can you say you “understand” something if you find yourself repeatedly making mistakes when you use it?

Re:Rust via its Core Values by glennsl on Sunday April 03, 2016 @07:28PM (#11418360)
Compare a hammer and nails to a nailgun with various safety mechanisms. Which one do you think is easier to understand, and which is more prone to sore fingers?
Re:Rust via its Core Values by catnaroek on Sunday April 03, 2016 @08:18PM (#11418574)
> Which one do you think is easier to understand?

For a toolmaker, the hammer. For a user, the nailgun.

Also, there's a qualitative difference between physical tools and programming languages. The design of a physical tool can only lessen the likelihood of an accident and/or the seriousness of its consequences, but never entirely rule them out - that's why they're called “accidents”. On the other hand, programming languages can be designed to treat logical errors as invalid code. A program that doesn't compile is completely guaranteed not to corrupt your data, reveal your passwords to hackers, etc.

Re:Rust via its Core Values by glennsl on Monday April 04, 2016 @08:31AM (#11421333)
What if you can't understand the logic of the compiler, and therefore aren't able to write any code in the language at all? Sure it's not very error-prone, but it's also not very useful.

I'm a big fan of Rust precisely because of its safety features. Even if you don't need manual memory management there are huge benefits to resource management safety that no other language can provide. But I still recognize that there's a trade-off here.

Re:Rust via its Core Values by cwyers on Sunday April 03, 2016 @07:07PM (#11418262)
Not who you're responding to, but go's ethos and tooling all seem oriented towards There's One Way To Do It, no cleverness, nothing like C++ where one shop's parts of the language used differs greatly from another's. That makes programmers much easier to swap in and out in a large project. I have no idea how productive go is and can't speak to it, but everything I have heard about go makes it sound like making programmers fungible is a design goal.