Live data from Hacker News

A Fresh Look at Rust

lucumr.pocoo.org

31–40 of 157 posts

Re: A Fresh Look at Rust

#31
post #6

I have a huge hatred towards both the STL and boost and that has existed even before I worked in the games industry. I really don't understand why STL gets so little love. It's a little lean on features maybe but in my experience it just works, and it's fast . Once you get your head around the iterator concept it's pretty simple to use. And with lambdas in C++ I can write code that's almost as concise as Ruby or Scal…

I really don't understand why STL gets so little love.

Well, in light of the fact that the author makes reference to his game industry background, you may find interesting the perspectives given in this paper: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n227...

And partial source code for the library described in the paper: https://github.com/paulhodge/EASTL

Re: A Fresh Look at Rust

#32
post #4

I've been using Rust to process a large text corpus, and as Armin suggests, it's a really interesting experience. Here are a few things I've noticed so far: 1. Writing Rust code definitely takes more time than Python or Ruby, but it's not bad in practice. I can't measure the productivity difference yet, partly because I'm still learning Rust. I do spend more time thinking about how to write zero-allocation and zero-c…

Over the past few days I have been trying Julia. While I don't have much of an idea what I'm doing yet, and I'm probably doing a lot of unproductive premature optimization for the sake of exploring, I see a similar type of difference compared to R and Python where I have more experience.

What I am curious about is why you chose Rust rather than Julia. As I've understood the chatter so far, Rust is great for low level programming, and can work well as a replacement for other system level programming languages. Julia on the other hand is supposedly tailored for the type of task you are talking about, and like Rust, the chatter says Julia can be similar to C and Fortan in terms of speed.

My understanding of Rust was as a low-level general-purpose language and Julia as a technical or scientific programming language that is similarly fast.

Anyway, I'm just curious about the trade offs.

Re: A Fresh Look at Rust

#33

> The truth is that the borrow checker is not perfect. The borrow checker prevents you from doing dangerous things and it does that. However it often feels too restrictive. In my experience though the borrow checker actually is wrong much less often than you think it is and just requires you to think a bit differently. I would love to see this explored in more detail. The borrow checker is, from what I can tell, one…

Soundness bugs come up once in a while, so yeah there is doubts. I wouldn't claim it to be sound until there is at least a proof of soundness of a theoretical model of it (which you can then show the implementation matches)

Re: A Fresh Look at Rust

#34

> The truth is that the borrow checker is not perfect. The borrow checker prevents you from doing dangerous things and it does that. However it often feels too restrictive. In my experience though the borrow checker actually is wrong much less often than you think it is and just requires you to think a bit differently. I would love to see this explored in more detail. The borrow checker is, from what I can tell, one…

Currently, borrows are always lexical. It'd be nice to have non-lexical borrows. It's on the todo list.

Re: A Fresh Look at Rust

#35
post #6

I have a huge hatred towards both the STL and boost and that has existed even before I worked in the games industry. I really don't understand why STL gets so little love. It's a little lean on features maybe but in my experience it just works, and it's fast . Once you get your head around the iterator concept it's pretty simple to use. And with lambdas in C++ I can write code that's almost as concise as Ruby or Scal…

I really don't understand why STL gets so little love. Well, in light of the fact that the author makes reference to his game industry background, you may find interesting the perspectives given in this paper: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n227... And partial source code for the library described in the paper: https://github.com/paulhodge/EASTL

The game industry does have somewhat unique requirements so I can understand why they'd need something more tailored. On the other hand that paper was written 7 years ago, which is ancient history now. For general purpose stuff I've found the STL works just fine, even in the realtime DSP stuff I've been working on.

The biggest problem I've had working with the STL is that people avoided it for a long time so when you're dealing with third party code you usually also have to deal with custom vector, string, list etc. implementations.

Re: A Fresh Look at Rust

#36

> The truth is that the borrow checker is not perfect. The borrow checker prevents you from doing dangerous things and it does that. However it often feels too restrictive. In my experience though the borrow checker actually is wrong much less often than you think it is and just requires you to think a bit differently. I would love to see this explored in more detail. The borrow checker is, from what I can tell, one…

Soundness bugs come up once in a while, so yeah there is doubts. I wouldn't claim it to be sound until there is at least a proof of soundness of a theoretical model of it (which you can then show the implementation matches)

That's a little scary. But giving it solid theoretical justification sounds like a perfect thesis for some CS or math grad student.

Re: A Fresh Look at Rust

#37
post #26

Earlier quoted context omitted.

I don't understand. What more do you need out of CSV parsing that any standard regex library doesn't provide?

I don't understand; why would you try and parse CSV with a regex? Note: CSV is actually much more complicated in practice than just splitting on commas.

regex is much more capable than splitting on commas

Re: A Fresh Look at Rust

#38

Earlier quoted context omitted.

I don't understand. What more do you need out of CSV parsing that any standard regex library doesn't provide?

There are plenty of values in a purpose built CSV parser. Several important features, depending on the CSVs you'll be working with are: 1. Sometimes you want to actually write files, in which case you'll want help escaping quoting. 2. Shortcuts for using header information to provide more convenient access into a particular column, rather than always doing it by index. 3. Conveniently slurp in only parts of a file, o…

All things a proper understanding of regex and a minimal understanding of streaming file IO can cover. The whole "if you think regex is the solution to your problem, now you have two problems" thing has gotten out of hand. Regex is not that hard.

Re: A Fresh Look at Rust

#39

> The truth is that the borrow checker is not perfect. The borrow checker prevents you from doing dangerous things and it does that. However it often feels too restrictive. In my experience though the borrow checker actually is wrong much less often than you think it is and just requires you to think a bit differently. I would love to see this explored in more detail. The borrow checker is, from what I can tell, one…

Currently, borrows are always lexical. It'd be nice to have non-lexical borrows. It's on the todo list.

Interesting. What is an example of a non-lexical borrow that could potentially be proven safe?

Re: A Fresh Look at Rust

#40

Earlier quoted context omitted.

Soundness bugs come up once in a while, so yeah there is doubts. I wouldn't claim it to be sound until there is at least a proof of soundness of a theoretical model of it (which you can then show the implementation matches)

That's a little scary. But giving it solid theoretical justification sounds like a perfect thesis for some CS or math grad student.

https://github.com/nikomatsakis/rust-redex is a theoretical model of the interesting part of Rust (by one of the core-developers). I don't think it's complete though.
Post reply on HN