Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
First taste of Rust (pudgepacket.github.io)
61 points by PudgePacket on July 31, 2014 | hide | past | favorite | 17 comments


Why don't experts write articles? Why do I see "my first experience with x" so much more frequently than "I've written large complicated systems in x, here's how I use it"?

I'm in no way criticizing the OP, I just wonder why these sorts of articles are especially valuable.


They do get written; you just don't see them on the frontpage as often. The crowd selects familiar things, like fixating on the syntax of a language, or the emphasis on the act of constructing a program (rather than the long-term maintenance). HN and /r/programming are pretty much mouthpieces for pop culture programming. Reinventing the wheel is perceived as newsworthy. Now, there's nothing wrong with pop culture programming! The only problem is when you stop growing in abilities and understanding.

Personally, I tend to read:

* lobste.rs (like HN, but more tech and less startup BS)

* /r/haskell

* Lambda the Ultimate

At all three of these sites I am regularly confronted with material I do not easily understand, so I lurk and take in what I can.


They are especially valuable to HN because most HN users have not used Rust for a long time [0]; they're still approaching the language.

I know your question isn't specific to this submission, but Rust is a new language, built to support an ongoing research project. Very few people, if any, could have written a large complicated system (apart from Servo).

Even if an expert were to write an article explaining how they use Rust, it would be of little use to most people using Rust at this point in time.

Example: Nobody was explaining how to use JavaScript for large complicated systems in 1998: the language itself wasn't ready for this kind of usage, and adoption hadn't reached the critical mass required for certain discoveries (language quirks, unexpected ways to do things, ready to use libraries and frameworks etc.) to be made.

[0]: Substitute Rust for any new language.


And in some ways, very few people have ever used Rust for a long time, because it's always changing. If you read the same article a year ago, it would have been different.


I feel the same way. Perhaps it is more difficult with large projects due to proprietary code and IP laws.


Is rust very geared towards writing network applications (like Go is to some extent) and lacking in other areas, or would you recommend it as a general language? I'm always curious about new languages, but my needs are mostly in maths/scientific computing. Would Rust prove a good (or at least OK) match?


Just give it a try - my guess is that it will fare similarly to modern C++, excluding libraries availability.


I guess so. Do you know if Rust has bignum? What do you use now?





Nice article though some of the code is less elegant than it could be, normally you would match the option to unwrap it and then match it's value, instead of doing a lot of 'Some( .. )' matches.

  let first_character = match line.chars().next() {
    Some( v ) => v,
    None => return
  }
  
  match first_character {
    '# => println!("Comment"),
    ...
  }


I played around with a few different configurations for that particular part, even having something similar to yours that looked like

  match line.chars().next() {
      Some(x) => match x {
  	  '#' => ...
  	  'v' => ...
  	  _   => ...
      },
      None    => ...
  }
But I felt that the current approach was fine. At this point it becomes more a decision of style and taste vs any kind of practicality.


I was pleasantly surprised by the combination of pure functions..

But Rust doesn't have pure functions.


Well, rust does have pure functions (as most programming languages) you just can't tag a function as such to have the compiler enforce the purity for you (it used to, though).

That being said I'm not sure why the author mentioned that point in particular. Maybe he feels that having immutable-by-default semantics encourages writing pure functions?


You've hit the nail on the head!


Hmm, perhaps I was a little overzealous in my attribution, I'll amend that, thank you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: