Live data from Hacker News

Exploring Rust (from C#)

nblumhardt.com

21–30 of 132 posts

Re: Exploring Rust (from C#)

#21

The annotated version of C# included in the blog post reminds me of Spec# http://research.microsoft.com/en-us/projects/specsharp/ Spec# has annotations and methods for object ownership. You can see an example of it in the "The Spec# Programming System: An Overview" slideshow (slide 39 onwards). Also: > C# has two families of data structures that dermine allocation behaviour: structs and classes. If a type is a struct…

Ah yes, my bad - the "value types go on the stack" simplification is a bit sloppy. It's a useful way to describe it to make the comparison - but definitely not for understanding C# in this case.

Re: Exploring Rust (from C#)

#22
post #3

Could someone explain why Rust is so damn popular/controversial?

Technical reasons alone don't clarify what's happening. Everyone's explaining basically why "Rust is awesome", which is not what was asked.

It's popular because Rust fans are heavily promoting it on HN as the solution to certain classes of programming errors. 2016 is probably going to be the year of Rust on HN, generally there's a new language every year such as Ruby, Javascript, etc. This year Go is a strong competitor and Elixir was looking strong but it fizzled out. :-)

It's controversial because users of other languages (understandably) don't want to rewrite their project, or they don't want to learn an entire new ecosystem that does exactly what the previous thing did, except in a safer way. Finally, some of them have enough experience to recognise that a new tool is never perfect, and we just haven't had enough time to figure out what the pitfalls and cons of Rust are.

The facts that Rust is quite young, has no shipping hero project as a case study and there are basically no jobs available are adding fuel to the fire.

Programmers are suckers for a good programming language story and love thinking that there's a language that is truly a joy to program in and will fulfill all their wishes. PL topics are always under heavy discussion.

Re: Exploring Rust (from C#)

#23

The annotated version of C# included in the blog post reminds me of Spec# http://research.microsoft.com/en-us/projects/specsharp/ Spec# has annotations and methods for object ownership. You can see an example of it in the "The Spec# Programming System: An Overview" slideshow (slide 39 onwards). Also: > C# has two families of data structures that dermine allocation behaviour: structs and classes. If a type is a struct…

Ah yes, my bad - the "value types go on the stack" simplification is a bit sloppy. It's a useful way to describe it to make the comparison - but definitely not for understanding C# in this case.

All good. Also, thanks for alt-composition and stateless.

Re: Exploring Rust (from C#)

#24
post #20

Earlier quoted context omitted.

I think a lot of people are looking for a replacement for C++ that isn't C#/Java. As in a language that is still low-level enough to offer stuff like pointers, but without the pitfalls and minefield which is C++ (a lot of which is due to historic reasons and backwards compatibility with C). Some newer languages that try to fill the niche are D, Nim, Rust and Go. Can't say much about Nim, it seems to be in the backgro…

> Some newer languages that try to fill the niche are D, Nim, Rust and Go. Can't say much about Nim, it seems to be in the background. Nim is frustrating, because to my taste it gets so many things just right while getting one particular thing so spectacularly wrong that I can't bring myself even to try it. The one thing is its rule for when two identifiers are the same. They are compared case-insensitively, ignoring…

Thanks a lot! I had never heard of Nim before, and I'll never ever try to know more. Such a gigantic error is a triple NO.

Re: Exploring Rust (from C#)

#25
post #3

Could someone explain why Rust is so damn popular/controversial?

I think a lot of people are looking for a replacement for C++ that isn't C#/Java. As in a language that is still low-level enough to offer stuff like pointers, but without the pitfalls and minefield which is C++ (a lot of which is due to historic reasons and backwards compatibility with C). Some newer languages that try to fill the niche are D, Nim, Rust and Go. Can't say much about Nim, it seems to be in the backgro…

I have done my share of critics regarding Go team decisions, but one thing they got right is that Go is indeed a systems programming language.

My understanding being that a systems programming language is one that can be used to bootstrap itself and build a full OS stack with the exception of some Assembly for interfacing with the underlying hardware.

As of Go 1.6, the language certainly fulfils this description.

If having a GC hinders certain use cases in systems programming, that is an orthogonal issue.

Edit: Looking forward to the day someone bothers to write an Oberon like OS in Go and HNers will keep on downvoting those that favour memory safe systems programming languages.

Re: Exploring Rust (from C#)

#26
post #19
post #14

Earlier quoted context omitted.

It is so popular because it elegantly solves a set of problems that plague systems-level programming (use-after-free, dangling pointers, data races). It is so controversial because there are system programmers who have lived for so long with those problems that they now refuse their existence.

You're right on the pros but dead wrong (intentionally?) on the cons. The real reasons it's controversial are: (1) it requires what some people consider excessive amount of annotations for borrowed types, resulting in visual noise, (2) it has an overly restrictive memory safety model (e.g. it prevents concurrent modification, even when provably safe), (3) it claims to be (memory) "safe", but requires (see 2) the use…

> (3) it claims to be (memory) "safe", but requires (see 2) the use of "unsafe" features for the most basic tasks, such as implementing various collections.

I think this is an interesting one - implementing collections is (IME) the main thing one needs to use unsafe for in rust. Outside of that I barely find myself needing it at all. Unfortunately, collections are also a go-to intro project for a lot of systems programmers, so I can see how it would be easy to get a bad first impression.

Re: Exploring Rust (from C#)

#27
post #3

Could someone explain why Rust is so damn popular/controversial?

I think a lot of people are looking for a replacement for C++ that isn't C#/Java. As in a language that is still low-level enough to offer stuff like pointers, but without the pitfalls and minefield which is C++ (a lot of which is due to historic reasons and backwards compatibility with C). Some newer languages that try to fill the niche are D, Nim, Rust and Go. Can't say much about Nim, it seems to be in the backgro…

> because there is a place for a language that is safer to use than C++, yet performs at similar speeds and doesn't handhold you like C#/Java do.

And sometimes some people (like me) would argue that C++ (11&14) is actually that language.

A subset of C++ is actually very perfomant and safe for most of the uses.

Re: Exploring Rust (from C#)

#28
post #19
post #14

Earlier quoted context omitted.

It is so popular because it elegantly solves a set of problems that plague systems-level programming (use-after-free, dangling pointers, data races). It is so controversial because there are system programmers who have lived for so long with those problems that they now refuse their existence.

You're right on the pros but dead wrong (intentionally?) on the cons. The real reasons it's controversial are: (1) it requires what some people consider excessive amount of annotations for borrowed types, resulting in visual noise, (2) it has an overly restrictive memory safety model (e.g. it prevents concurrent modification, even when provably safe), (3) it claims to be (memory) "safe", but requires (see 2) the use…

The collections criticism is bizarre. How often do you actually have to use "unsafe" in practice? Collections is one example, but it seems to be quite atypical, and not something you'd typically implement yourself.

The argument has always been that it reduces the amount of code you have to check for safety manually. Most of it will be checked by the compiler. Have you run into the problem that most of your code is unsafe?

I've only started dabbling in Rust for some projects, but I've not had to write a single line of unsafe yet, and don't see where that would change.

Re: Exploring Rust (from C#)

#29
post #22
post #3

Could someone explain why Rust is so damn popular/controversial?

Technical reasons alone don't clarify what's happening. Everyone's explaining basically why "Rust is awesome", which is not what was asked. It's popular because Rust fans are heavily promoting it on HN as the solution to certain classes of programming errors. 2016 is probably going to be the year of Rust on HN, generally there's a new language every year such as Ruby, Javascript, etc. This year Go is a strong competi…

> The facts that Rust is quite young, has no shipping hero project as a case study and there are basically no jobs available are adding fuel to the fire.

That's a bit of a misrepresentation though. Rust code is shipping in Firefox, and more importantly, Servo will have an alpha release in June.

The close integration between Rust and Servo development, as well as the rigorous pre 1.0 process also set it apart from other languages of comparable age.

Re: Exploring Rust (from C#)

#30

Earlier quoted context omitted.

I think a lot of people are looking for a replacement for C++ that isn't C#/Java. As in a language that is still low-level enough to offer stuff like pointers, but without the pitfalls and minefield which is C++ (a lot of which is due to historic reasons and backwards compatibility with C). Some newer languages that try to fill the niche are D, Nim, Rust and Go. Can't say much about Nim, it seems to be in the backgro…

> because there is a place for a language that is safer to use than C++, yet performs at similar speeds and doesn't handhold you like C#/Java do. And sometimes some people (like me) would argue that C++ (11&14) is actually that language. A subset of C++ is actually very perfomant and safe for most of the uses.

Which is absolutely fine, but competition is never a bad thing.
Post reply on HN