Hacker News new | ask | show | jobs
by cscottnet 4598 days ago
Oh, look, my rant finally got noticed. ;)

First off -- yes, it is a rant. I actually had some more nuanced in-person conversations, but those aren't nearly as fun to post. So you get the version that was fun for me to write. Sorry.

That said, I'm glad to hear Rust is all wonderful now. It sounds like pcwalton agrees with most of my points and got them fixed. Kudos. I look forward to better GC, fork-join parallelism, and work-stealing.

It doesn't seem like anything significant was done with the type system, though. How does Rust handle "find_and_insert" now?

If folks are interested in actually critiquing code style, feel free to check out the rusty-turtle code at http://cananian.livejournal.com/68747.html. I disagree that I was trying to write Rust as if it were some different language -- my frustration was in part because I was trying to write things with Rusty ownership types, etc, and getting that to work properly was so frustrating (and the error messages so opaque). If I just stuck managed boxes around everything my life would have been simpler -- but then I would not have been programming in Rust, really.

I'm interested to hear more discussion on the primary point made in my blog: is Rust supposed to be 'safe and fast'? Or just 'safe'?

2 comments

> I'm glad to hear Rust is all wonderful now.

Nope, we're not saying that yet, Rust still needs a ton of work!

> How does Rust handle "find_and_insert" now?

Google doesn't return any obvious results for this string, what is it supposed to do?

> is Rust supposed to be 'safe and fast'? Or just 'safe'?

If Servo (written in Rust) isn't faster than Gecko (written in C++), then Mozilla won't continue funding Rust. Rust needs to be fast in a very existential way. :) And it will be! Initial benchmarks of Servo's performance are incredibly promising (pcwalton could go into more detail here), and there's still bushels of low-hanging fruit to be plucked.

>If Servo (written in Rust) isn't faster than Gecko (written in C++), then Mozilla won't continue funding Rust. Rust needs to be fast in a very existential way.

Ouch, I didn't know the project had a deadline. By when does it need to be faster?

kibwen is not speaking for the Rust team.
Indeed I'm not! Just an over-enthusiastic community member here. :)
Ok, that makes me feel better. I've been watching and waiting for Windows support to get better, and I'd hate to have it fizzle before I really got to play with it.
re: find_or_insert

http://static.rust-lang.org/doc/0.8/std/hashmap/struct.HashM...

It appears to still have the mandatory copy. (And this is just one example of a pervasive issue with the standard library.)

If that's the problem, it's really rather easy to define a wrapper that only clones on an insert. (And, I fundamentally disagree that over-copying this is a pervasive issue; there are a few places (mainly old code) where unnecessary Clone-ing is performed, but this is very much the exception.)

  fn find_or_insert_clone<'a, K: Clone, V>(map: &'a mut HashMap<K,V>,
                                           key: &K, val: V) -> &'a mut V {
      match map.find_mut(key) {
          Some(x) => return x,
          None => {}
      }

      // `key` is definitely missing
      map.find_or_insert(key.clone(), val)
  }
> I actually had some more nuanced in-person conversations, but those aren't nearly as fun to post

Meta: I'm pretty disappointed with this sentiment. I would have loved to read those discussions instead of a rant. They seem far more intellectually honest.

Sorry, I gave Mozilla about 3 weeks of free work, then travelled to SFO and talked with Rust folk in person. That's a lot of donated time. I was working on another project by the time I wrote this post (from my written notes). Try not to look the gift horse in the mouth.