let r = match argv.get(1) { Some(x) => match x.parse::<i32>() { Ok(v) => v, Err(_) => { show_usage(); panic!() }, }, None => { show_usage(); panic!() } } }
Type explosion is to be expected. Do notation could have been used to keep the control logic as clean as C, but Rust is not HASKAL and never will be anything like HASKAL and you're an asshole for wanting to write readable code you filthy shit fuck.
Name:
Anonymous2015-02-16 3:25
>>37 Doesn't Rust have optional GCC through one of its @ pointer type?
Name:
Anonymous2015-02-16 8:36
>>41 It has GC via the RC and ARC types ((atomic(?)) reference counted) but the linear type system is clearly better than GC, and I'm pretty sure cdr was being facetious when shim said it is essential.
>>41 No, @-pointers were removed and the planned GC was never implemented. You can use Rc<T> but I don't think there's a cycle collector.
Name:
Anonymous2015-02-16 8:44
oh and what's up with everyone converting to reference counting to 'get away from the GC'
refcounting is a form of GC and is far, far slower than a proper GC, and there's no real proper way to defer cleaning up refcounting for an 'opportune' time like with a 'real' GC unless you... introduce a 'real' GC.
The idea that malloc/free has no overhead is absolutely ridiculous too, as if GCs suddenly make memory management slow. Realtime programming is done by never using anything except stack memory and preallocated buffers, GC or not.
rust feels like a meme language made by people who have never really done any form of low level programming
t. someone who writes embedded software for medical devices in pascal for a living
Name:
Anonymous2015-02-16 8:55
The only people who shill Rust are people who haven't actually used it.
Yes the safety mechanisms are great in theory.
Yes we need a modernized version of C++.
But try to actually write something bigger than FizzBuzz in the fucking language and you'll quickly see why it'll never take off: Working in Rust is a bitch. It's inconvenient, has convoluted non-intuitive syntax and is just simply not fun.
Name:
Anonymous2015-02-16 8:58
>>44 I don't know why you would think that. We know RC is a form of GC, so there's no "getting away from GC" in using RC. RC is a cheap way of GC-ing select pieces of data without having to irreversably munge the whole damn runtime to use GC everywhere. Therefore Rust's GC is "oh, if you insist you really want GC, here's something". Plus Apple have been using RC'd GC for years.
Name:
Anonymous2015-02-16 9:01
>>45 I agree. 95% of using Rust is wrestling with the godawful module/crate system.
Name:
Anonymous2015-02-16 9:25
The guy who was trying to make an OS in Rust gave up, and switched to the Nim language.
>>44,48 Rust is handicapped because it is a Mozilla project. All posturing to the contrary, making the language suitable for use in unhosted applications like kernels does not add a lot of value for Mozilla. Mozilla isn't writing kernels, they're writing a browser and they want a simpler safer alternative to C++ for that purpose. Once that is understood it should no longer be surprising that things like decoupling from libc are in fact a complete mess in Rust.
This is a sad situation if you're actually looking for a practical alternative to C in non-userland code, because there really is a lot of room for improvement there.
Name:
Anonymous2015-02-17 23:30
Rust is unarguably better than HTML.
Name:
Anonymous2015-02-17 23:42
You know what's even better than both Rust and HTML? check'em!
Name:
Anonymous2015-02-17 23:48
The solution, as always is Lisp Machines
Name:
Anonymous2015-02-18 0:07
>>54 Bullshit. My HTML code runs faster and is more readable than Rust could ever be.
>>53 It's not so bleak. The libc business is something you can work out and will probably become saner in the future if people actually want to use it that way. If you're targeting ARM http://zinc.rs probably has you covered already.
will probably become saner in the future if people actually want to use it that way
If so it will be the first Mozilla project I know of to have that success.
That link gives me some hope though - the principal author is bang on about the potential benefits global optimization can bring in this space. I am completely sick of having to pamper C compilers and their Byzantine unit-at-a-time linkage model. (And don't any of you dare bring up inlining as a solution - that's like conflating remission with metastasis).
Name:
Anonymous2015-02-18 9:11
If so it will be the first Mozilla project I know of to have that success.
If you don't hate ES, I would count it as a success in that area. If you do hate it, I can see how you'd see it the other way (eg. wanting a bytecode.)
If you check the committers for zinc.rs you'll find that most of them also have contributions to Rust. The Rust team has generally sided with making this kind of thing possible (and pleasant though it's not exactly a priority.)
Name:
Anonymous2015-02-18 12:18
>>53 Hey, this is pointless to say because you won't listen and you don't care, but Rust isn't a Mozilla-controlled project like Firefox. Mozilla sponsors Rust by hiring people who contribute to the project, so that they'll put as much energy as possible into further contributions. The actual development process is very transparent and there's no special status for Mozilla-employed contributors over random people with a lot of spare time. What matters is that you know your shit and you can write words and code to back it up.
>>61 I'm ambivalent on ECMAScript - I just didn't count it as a victory for Mozilla per se because it was already gaining ground when Netscape still existed.
>>62 I know what an open source project means. Having a lot of paid developers on the project confers influence and it's quite naive to maintain otherwise.
Name:
Anonymous2015-02-23 8:24
fn main() { let r = match std::env::args().map(|x| x.to_string()).nth(1) { Some(x) => match x.parse::<i32>() { Ok(v) => v, Err(_) => panic!("Argument must be an i32."), }, None => panic!("No arguments were given."), }; }
>>69 Negative. I noticed my shitpost was posted to the Rust subreddit by someone who works on Rust and Servo and decided to gloat. They hid the story immediately and I can't decide whether I feel ^ ^ or ; ; about that.
Name:
Anonymous2015-02-23 13:19
>>3 Haha, enjoy your <::>::<>::<>::><><::><::<>::-itis. Haskell's syntax is so much better.
Name:
Anonymous2015-02-23 14:55
You do not need to annotate most types; I can't tell if this is b8 or you are actually this ignorant, because you are misrepresenting idiomatic rust with extreme prejudice. Just because you have not learned the language yet does not mean you can bash on it (in fact, quite the opposite…)
#![feature(env)]
use std::env::{args, set_exit_status};
fn main() { let r = match args().nth(1) { Some(a) => a.parse::<i32>().unwrap_or(0), None => { show_usage(); set_exit_status(1); return; }, }; }