Oddbean new post about | logout
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @buy robux today :ROBUX: rust takes the approach of mpsc (something like Go channels) to share resources between threads and the capture clause is something like std::thread t{[<move fucking everything>](args...) {}}; so everything in the thread is local, it sort of forces you a paradigm 
 @loopy pedestrian✍🏿 @buy robux today :ROBUX: not familiar with mpsc but I'd gladly research any pattern that makes multithreading less fucking awful. It's getting to where application programmers never multithread and systems programmers have to multithread every god damn day 
 @loopy pedestrian✍🏿 @buy robux today :ROBUX: by the way this is why I have no faith in rust as a serious project

https://media.clubcyberia.co/pleroma/b7a48e6eb7affd30a7a29ef040f56986597ef4b1779e38474aa78eafa7d6854b.png 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @loopy pedestrian✍🏿 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @buy robux today :ROBUX: 

Tell me a little bit about Rust.  What is it good for?  Why would I learn it?

I’ve heard they use it for cryptocurrency shit. 
 @e9ab4887 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @loopy pedestrian✍🏿 something about it being memory safe 
 @buy robux today :ROBUX: @loopy pedestrian✍🏿 @e9ab4887 it's allegedly memory safe without use of garbage collection. That's a big deal, but it also has a bunch of problems. Murderous compile times being one. Also the people that own it are :nigga :niggainsane: insane: 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @buy robux today :ROBUX: @e9ab4887 nigga we're in C++ land murderous compile times are our lifelong friend. 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: only if you use templates and don't pimpl! In rust it's mandatory.

C++ actually compiles insanely fast if you get stuff out of headers 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @e9ab4887 @buy robux today :ROBUX: maybe i should change the way i program in c++, 20 seconds for one translation unit is a norm for me because i use a million header-only template libraries. i should probably employ better practices (especially if i want to be employed lmao) 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: it's relatively straightforward to write fast compiling C++ code but it's very very hard to go back and fix it if you wrote it wrong in the first place. The biggest thing, by far, though is get templates out of your headers. 

also don't use boost. Nobody uses boost anymore. We USED to use boost because it had a bunch of stuff that was useful before it got put in the standard. Now it's in the standard and boost is just pure cancer and kills everything it touches. 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @e9ab4887 @buy robux today :ROBUX: boost::asio seems pretty useful (its the only boost library i use) but other than that yeah, theyre pretty redundant. but i feel like a lot of the STL headers have the same problem as boost too since a lot of them actually come from boost in the first place and shit like <algorithm> and <numeric> are almost entirely template-based. it's hard to get out of this template jail im in (i would like some tips).
Rust basically mandates this with traits (concepts but :sane:) but that's another story i guess.

https://media.clubcyberia.co/pleroma/f90d933f208ae15b41a92089ee3f0df2b103438c91d5412a94cfb619b8c38c49.png 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: the containers in the stl are of the same nature as the ones in boost but boost writes them in the most retarded way possible with, possibly not an exaggeration, 300 nested templates inside eachother. It's good to not include stl libs in class headers where reasonable but I have never experienced significant slowdown from them. Including even one single boost header can triple your compile time instantly.

I mean come on you saw that template error right? Is that not the most satanic thing you've ever laid eyes on?

If you MUST use boost you should write an adapter class that just declares the functions you need in a header and then the implementations can actually call the boost functions. That way you only poison a single cpp file. I did this with good success in my last project before I just completely abandoned boost. 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @e9ab4887 @buy robux today :ROBUX: what's your thought on <regex>? it was so slow i just resorted to using boost::regex and calling it a day. or maybe i should use RE2.
also how do you do networking in C++ without asio? 
 @loopy pedestrian✍🏿 @e9ab4887 @buy robux today :ROBUX: regex in general is quite slow and the use of it should be pretty selective. I've never found c++ regex to be particularly troublesome as long as you're sure to precompile your statements. For networking there's various libraries everywhere. Socket calls suck but the abstraction layer over them doesn't need to be very fancy before they start not sucking. So in short figure out what you actually want to do with your sockets and there will be a very simple and reliable library for it. 
 rust is next level, the entire crate is considered one compilation unit. It’s probably good for inlining though. 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @loopy pedestrian✍🏿 @buy robux today :ROBUX: @e9ab4887 you're on fediverse bro, most of the people here are insane 
 @Johnny Peligro @loopy pedestrian✍🏿 @buy robux today :ROBUX: @e9ab4887 excuse me I've never threatened to sue anybody if they mentioned rust at a conference that allows firearms 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @loopy pedestrian✍🏿 @buy robux today :ROBUX: I’m not going to lie, the Code of Conduct stuff was the final nail in the coffin for me and it makes it extremely difficult for me to take projects seriously. I also know that the CoC was only implemented for one demographic. 

Github is shit and might as well be hosting your projects directly to microsoft, unless you enjoy having your repos scraped by recruiters. 
 What, you do you not like 34MB replacements for ls? 
 @djsumdog @loopy pedestrian✍🏿 @buy robux today :ROBUX: "industrial strength fizzbuzz written in rust" 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @djsumdog @buy robux today :ROBUX: not sure about rust but here's some industrial strength compile-time fizzbuzz in C++20

https://media.clubcyberia.co/pleroma/055dc55d470c708979bd0f85116d49d5c8e0481bba33284fc6047ebb61c0da4e.png 
 Would the BrainFuck version be shorter? 
 @djsumdog @loopy pedestrian✍🏿 @buy robux today :ROBUX: it would certainly compile faster 
 @Fe₂🦀₃⋅H₂🦀 ( 7,600 / 28,000 ) @djsumdog @buy robux today :ROBUX: brainfuck is interpreted so there's no space for flamboyant template fuckery 
 @loopy pedestrian✍🏿 @djsumdog @buy robux today :ROBUX: well I interpret it as a compiler 
 I don't actually know a lot about brainfuck, but all JVM (Scala, Kotlin, Clojure) and .NET languages are both compiled and (byte code/JIT) interpreted. I think that pattern originated with SmallTalk? 
 to be fair that’s a rule on reddit, redditors are cancer

rust proper definitely has its fair share of “redditors” though…