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-13 1:22
>>1 The rust program handles malformed integers while the c program does not.
Name:
Anonymous2015-02-13 1:45
who the fuck thought std::herpes:::::::::this or <Nigger,<DoubleNigger,Nigger<<<<<<<This>>>>>>>> was a good idea
Name:
Anonymous2015-02-13 1:52
>>2 And it could do that in a way as clean as the C version by using do notation.
>>2 Maybe the programmer shouldn't make the integers malformed? Programmer school, did you flunk?
Name:
Anonymous2015-02-13 3:32
HAHAAHHAHAAHHAHAHDAHASDHUAEGRYAHOINGRHUITRJOEAGHOIHUIOWHAWAHGUIHAAGHRAWEGRHU RUST RUST RUST THE NEW HIP LANGUAGE RUST, I CANT WAIT TIL THE COMPILE RIS MORE MATURE. IM SO EXCITED ABOUT LEARNING RUST. MAYBE TRY RUST? LOOLLOLLOLOLOLOASDFLOASKOASHOKAHFJIOAFOIJ.
>>32 As hard as choosing benchmarks that repeatably measure the impact of an optimization on the entire system in which it is used, and nothing more (such as the impact of the benchmarking method itself).
Name:
Anonymous2015-02-16 2:48
Is Rust the future?
Or will it simply corrode as a language ha ha ha
There are two possibilities:
1. Rust will become a true Systems Language, and will be able to surpass c / c++ in areas where they are truly necessary ( device drivers, embedded etc )
2 It will die, because there are better alternatives available if you want abstractions.
I personally hope the first case will become reality.
Name:
Cudder!MhMRSATORI2015-02-16 2:54
Rust has the potential to be the best language since FORTRAN 77. Too bad it doesn't have GC, which is ESSENTIAL for us 21st Century Programmers.
Name:
Anonymous2015-02-16 3:02
D > Rust > JS > Go > Haskell > OCaml > C > Python > Ruby > Lua > Perl > Bash > HTML > Java > C++ > C# > .NET
>>39 dont 4get ##programming on irc.freenode.net :)
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; }, }; }
>>82 Are you talking about chained method calls, where methods of foo all return foo? Because that's not function composition.
Name:
Anonymous2015-02-24 19:05
>>79 You drunk or something? You wrote the type for (.), not (&).
Name:
Anonymous2015-02-24 19:11
>>80 No, you idiot, it's for those who like readable code. Haskell is riddled with direction-inverting operators like
<- -- Hebrew >>= -- White << -- Hebrew ($) -- White (.) -- Hebrew
that make expressions impossible to decode because the control flow in them starts in an unobvious place and changes direction several times. So I just find it saner to choose one direction and settle with it instead of having to visually parse unreadable shit like
x <- (f g) . (h . j. z $ i) $ y >>= return (f . m << negro)
Name:
Anonymous2015-02-24 19:41
>>79 Moreover, the lens (&) is just reversed function application
Take malloc and free out of C, add some static analysis for bad pointer usage
What is C++ new/delete and smart pointers?
Name:
Anonymous2015-02-28 11:36
>>106 new/delete are malloc/free + constructors/destructors respectively. Smart pointers look like they incur unavoidable runtime overhead. Also you should really check your grammar.
Name:
Anonymous2017-01-19 14:25
>>9 Here's the assembler code generated by rustc for the standard Hello World program:
This is from the compiler explorer site, on my Linux VM the output is even more horrific (to the point that it's too large to post here). In both cases I'm pretty sure it's the latest version of the compiler, 1.14.0. I'm not that experienced with assembly, but it looks to me like it's using 64 bytes of stack space, which is ridiculous for such a trivial program.
For comparison, GCC 4.4.7 with optimization off produces the following Hello World code:
>>82,84 OOP is based on partial application, not function composition. Converting a.hax(&a, 5) (C style) to a.hax(5) (C++ style) is essentially an example of partial application. You take a binary function, and use partial application to bind the self-reference argument to the parent object to create a unary member function.
>>86 It would be function composition if the language had some way to define the chain as a new function. Mathematically speaking, f(g(5)) isn't function composition, it's just using the function g with the argument 5, and then using the result as the argument to the function f. Now, if you instead did something like h(x) = f(g(x)), that is function composition, because you're defining a chain of functions as a new function. Likewise, m.move_north().move_east() isn't composition, but something like movable movable::move_northeast() { return this->move_north().move_east(); }
would be.
>>106 Static analysis means it's done at/before compile time. Smart pointers are basically a form of runtime GC. Rust's main selling point is that the features that make it ``safe" are all done at compile time, thus causing no run-time penalty.
Name:
Anonymous2017-01-31 3:45
Lets see these rust guys implement diffoubly linked lists
Name:
Anonymous2017-01-31 3:46
trips upcoming
Name:
▄︻̷̿┻̿═━一2017-01-31 3:47
THESE 2nd AMENDMENT TRIPS
Name:
Anonymous2017-04-29 18:56
Rust is very fast.
C: #include <stdio.h>
int main() { int total = 0; for (int i = 0; i < 100000; i++) { for (int j = 0; j < i; j++) { total += (j * j == i) ? j : 0; } }
printf("%lu\n", total); return 0; } 50085 real 8.25 user 8.25 sys 0.00
fn main() { let mut total: i32 = 0i32; for i in 1..100_001 { for j in 1..i { total += if (j*j) == i {j} else {0i32}; } } println!("{}", total); } 50085 real 2.61 user 2.61 sys 0.00
And it's fair to claim that Rust enforces memory safety unlike C or C++. Reason why C/C++ programs are so vulnerable. The example in the OP just goes to show Rust handles errors better and it trains the programmer to do so.
Rust has a decent dev environment. The cargo is a very good project manager, Rust language server is the combination of Clang format, Clang complete and CPP check, with more features like snippets etc. And lastly, the Rust compiler is very impressive. For a language that's 2 years old it certainly helps produce fast, optimized and safe binaries that C never did. Rust compiler is like GCC+CPP check combined.
So FUCK YOU. Stay confined in your bubble world of baby duck syndrome while you can, I just got sick and tired of edgy C tards like you. No wonder C is dying.
>>1 At least Rust has figured out how to eliminate the need for significant whitespace in nested generic type declarations.
>>115 I'm not familiar with Symta, however not having to declare variable types means either that you don't know for sure that your variable is represented as a 32-bit signed integer, or that the language uses implicit typing rules which can hurt readability. Either way, it's not really a truly ``synonymous" statement to the Rust variable declaration. I do think having to specify the variable type both in the variable declaration and in the literal being used to initialize the variable is ridiculous. Something like let mut total = 0; is understandably dangerous, since nowhere is the actual data type of the variable explicitly stated. But either let mut total: i32 = 0; or let mut total = 0i32 should be fine. Otherwise you're just being needlessly redundant.