/tech/ - Tech

Technology.

catalog
Mode: Reply
Name
E-mail
Subject
Message

Max message length: 8192

Files

Max file size: 80.00 MB

Max files: 5

Password

(used to delete files and postings)

Misc

Remember to follow the rules


(13.45 KB 474x313 rusty.jfif)
Comrade 05/19/2020 (Tue) 12:29:05 No. 1835
Can someone explain me the deal with rust? Like I get it is a programming language similar to C++ and C but it provides more memory safety. Is it worth while switching to it, or is it just better to stick with C and C++ for not very public and big projects?
You should learn a language if you want to learn it.
>>1835 It exists to please the erratic devs at mozilla who were tired of dealing with memory leaks from abusing the dumbest features of C++ used in the browser, without understanding that safetly is gained by better code not by living in the 4 layer abstraction world of Bjane Stroustrup. If you badly want to switch, first consider the syntax, which is terrible. It looks like sepples mixed with pascal or something. My advice is not to bother with it unless you want to show off to someone. Stick to the most supported languages and then if Rust will become more popular you can complain that it doesn't satisfy your paradigm of programming in general. Like the slow compile times present in nearly all "modern" languages.
(55.84 KB 600x338 IMG_6247.jpeg)
>>1840 Oh fuck off with that garbage excuse of a language. C++ is fundamentally bloated and yet it still doesn’t have good type safety or memory management. “Good code” in C++ is as good as bad code in rust. If you can’t take advantage of a language’s features because it results in “bad code”, then I don’t think that’s a problem with the programmer, I think it’s a problem with the language. The Rust compiler is strict so as to avoid any bugs FROM THE GET-GO. The syntax of rust is also pleasant to some and shit to others. Actually using the fucking language is needed to get a “feel” of the syntax. So fuck off with your bloated horse-shit language you cro magnon.
would've preferred if mozilla just wrote a custom compiler option and static analyser for c++ instead of making a whole new language
>>1844 You can’t fix garbage by creating another standard, you’ll just have another garbage standard
(43.82 KB 960x512 stroustrup.jpg)
(116.44 KB 400x400 1407625241750.png)
>>1846 And then there's Lisp.
>>1835 >is it just better to stick with C and C++ for not very public and big projects? Imo Rust is far better for small projects than C/C++ (big ones too unless there is a specific library you need). It has much better type inference, sugar, and abstractions, so you will be more productive (like Python), but the big thing is the package manager and build system. You don't get bogged down with the awful build systems and library management of C/C++. Much better for making a quick script or whatever. The memory safety is a great bonus.
>>1846 According to Bjarne, C is a language "no one uses"
>>1854 {{Citation needed}}
>>1859 It was a joke.
>>1854 If you think nobody complains about C you need to talk to people who actually have to use it. It is far from perfect.
(27.12 KB 444x316 ac.png)
>>1842 Did you even read my post? Yes C++ is a bloated garbage that's what i was saying, just a quick look over the 1100 pages its standard book has will tell you that. Even C is overloaded with crap. By me, if it was portable i would have written everything in fasm as opposed to relying on someone else to babysit and guide my programming with features and safety, which are commonly mutually exclusive. Better let me understand exactly what's happening so i can adapt in advance. >If you can’t take advantage of a language’s features because it results in “bad code”, then I don’t think that’s a problem with the programmer, I think it’s a problem with the language. >The Rust compiler is strict so as to avoid any bugs FROM THE GET-GO. Then why the fuck would you implement the restrictions in the compiler and not in the language, IF the language was the problem. It sounds just like >Language in bad because i can't use all of its features without problems, so let's put the compiler to tell you what's good and what to avoid. Instead you get to see the unsafe keyword spammed all over the place. From what i see, people who usually complain about this are also the ones who bitch because of the lack of features. Muh OOP, muh generics, muh memory, muh overloading, muh other irrelevant feature only webdevs use. And then you wonder why it shits a brick when used seriously. This is exactly how C++ came into existence, just add more abstractions and a dozen of features every 3-4 years and juxtapose them over the old and tired C syntax. And to fix that? well of course, add MORE features. See how C++20 is supposed to fix the slow compile times. Lastly, a simple program is safe by default in pretty much any language, without a need for Rust or GC. >The syntax of rust is also pleasant to some and shit to others. Actually using the fucking language is needed to get a “feel” of the syntax. This is the worst part about rust. There is absoultely nothing more braindead than enjoying and overusing :: on every line. Not to mention that's just scrapping the surface. It's like you learned nothing from the problems suffered by C++. Was the . and -> keywords from C too much that you go as far as using it everywhere? How is this crap pleasant? use memmap::MmapOptions; use std::io::Write; use std::fs::File; let file = File::open("README.md")?; let mmap = unsafe { MmapOptions::new().map(&file)? }; But of course, i'm the problem, i'm the cnile boomer who refuses to feel this beauty.
(38.64 KB 1200x816 csoy.png)
>>1871 Cringe
(534.77 KB 1440x1016 c & rust.png)
(3.67 KB 150x150 npC.jpg)
>>1876 >he pressed "reply" with this oc cope
>>1873 >everything i don't like is soy
>>1877 >oc https://rbt.asia/g/search/image/3HaPkU1ZKPJmidC3Vtd4Cw/ If you're going to respond with nonarguments at least get your memes right.
(76.15 KB 1080x1331 chad.jpg)
>>1878 Yes >>1879 No
>>1866 people in your CS1 class who never wrote a line of code before being assigned homework in C do not count as "people who actually have to use it"
Holy shit this board employs just as much magical thinking as /g/. I'm fucking disappointed.
Rust: - it's fast - algebraic types and type inference - very nice standard library - often more ergonomic and abstracted than even Python or Ruby, thanks to what it borrows from the FP langs - great package manager and build system - some very nice libraries - fairly expressive - beautiful error messages NGL, I don't script in scripting languages any more. I use Rust for that. Scripting in Python is painful-- the documentation is ass, you have to worry about tons of stupid runtime errors, transforming data is frequently non-obvious due to the lack of types and docs... There is literally no reason to write scripts in a dynamic language when there are plenty of strongly-typed languages with inference these days.
It's C++ with features from functional programming languages and a compiler that ensures you're not writing any segfaults
>>2044 >>2045 rust is great but unfortunately these sorts of languages that are popular with the FLOSS crowd and startups (Rust, Go, any FP lang) are not taught in university and additionally most guides for particular topics use more mainstream languages. So its a higher barrier to entry for beginners
>>2046 Oh no you have to learn a language before you can use it?? Why didn't the creators think about it?
>>2044 >There is literally no reason to write scripts in a dynamic language when there are plenty of strongly-typed languages with inference these days. Python is less verbose, has tons of libraries and utility functions that do most of the work and it runs anywhere python is installed.
>>1840 Fuck off stephenlynx
>>1840 >without understanding that safetly is gained by better code not by living in the 4 layer abstraction world of Bjane Stroustrup. >just dont make mistakes brooo >why do you write a language where you cant make those mistakes in bro, just do it right bro
I love Rust, but it's completely useless for audiovisual projects due to the libs
>>2076 fuck you mean bwoy
>>2051 >Python is less verbose, Rust doesn't have pointless verbosity like Java. You don't have redundant type annotations if you don't want them. All of the "verbosity" in Rust is meaningful information that documents how the program works, and increases readability and ability to reason about the code. In Rust, you explicitly declare whether a function takes or returns a reference or a value by copy or move. In Python you have a clusterfuck of multiple-ownership references, everything mutable, etc. This is even worse for Python if you're comparing it to something like Haskell. Haskell programs are far more succinct than Python programs. >has tons of libraries and utility functions that do most of the work Rust and Haskell have these too. Not always the same libraries and functions, but many of them. And they have things Python doesn't have as well. >it runs anywhere python is installed *anywhere you have a compatible python version and can afford wasting resources
These threads are very non-directed and rarely have any meaningful content. I know this board is very young but please let's end the /g/ posting tradition of asking the same arbitrary questions and getting the same useless answers.

Delete
Report

no cookies?