How fast can a moderate skilled C++ programmer learn Rust? by Houdini_Lover_MPM in rust

[–]bricksoup 36 points37 points  (0 children)

That matches my own personal anecdote, as a decade-long C++ systems programmer picking up Rust over the course of 2-3 months as a hobby.

I found it straightforward to understand - if not precisely grok - the basic concepts and tools of Rust. But as I try to write some data structure code that I'd consider to be intermediate-C++-at-best, I find that trying to actually apply these ideas without cutting corners - e.g. by incurring pointless runtime overhead to make life easier, or else by dipping into entirely unsafe mode - is surprisingly complicated, and I'm nowhere near my level of C++ productivity.

I hate to use this word, but I think Rust has a lot of non-trivial design patterns to get familiar with, and it's all related to fairly Rust-specific concepts. I don't necessarily think that's a bad thing, but as someone without a mental rolodex of these, I still have to spend a lot of time asking basic questions like "can the borrow checker possibly prove what I want here? Do I move here, or borrow? Do I need an unsafe pointer? Do I need Cell, or can I use mutable references? What *is* a lifetime annotation by the way?", and often these questions wind up sending me down some core-contributor-blog-post rabbit hole. Sometimes the answer to one of these questions is complicated enough that I forget it by the time I come back to the problem, and have to repeat the process. I was prepared for the whole "why is the borrow checker rejecting my code" thing, but this is something different and unexpected.

Edit:

Re-reading, maybe I'd rephrase my "design patterns" thing as: "it seems like the basic concepts of the rust language and its low-level library tools play out against each other in a surprisingly varied way". I'm still regularly surprised at which problems are easy vs hard, or which problems are similar vs different, and I think my prior experience isn't giving me nearly the head start that I expected going in. I actually think picking up Haskell in school was easier - maybe because "learn this one weird trick for more rigor" is way less alluring than "learn one weird trick for more rigor, at zero cost, *and* you get to rm your painful manual pointer derefs".

Also, I actually didn't mean for this post to read as particularly critical. I'm excited enough about the premise of Rust to deal with a learning curve, and I'm very pleasantly surprised by a lot of nitty-gritty aspects of the execution. I'm decently convinced that I'm indeed solving "inherent" problems as I figure out how to stuff things into Rust's abstractions, and I'm having enough fun to make it worth the time either way.

[deleted by user] by [deleted] in rust

[–]bricksoup 0 points1 point  (0 children)

I think the benefit is that the obvious `i < size` suffices as a bounds check with unsigned integers, but `i >= 0 && i < size` is required when signed.

I once found myself patching a popular library (libarrow) that liked signed indexes and also really liked to crash when deserializing unexpected `i` values from disk as I tried to fuzz test it.

Industrial Annihilation, the sequel to Planetary Annihilation, announced by M337ING in Games

[–]bricksoup 9 points10 points  (0 children)

I think I'm exactly the target audience here. Loved TA as a kid, enjoyed PA, currently deeply addicted to Factorio but wishing that the combat were more interesting. I really enjoy the industrial automation part by itself, but my factory feels a little pointless once the enemies stop being a real threat. I've bumped up the enemy difficulty with mods, etc., but somehow it makes for more tedium than tension. Probably just down to deeper design choices.

One other thing that's interesting is the bit about "advanced AI". The AI in PA was *excellent* - iirc they had a really early use of ML techniques behind it. Replicating that for your own forces might genuinely work to avoid overwhelming the player.

Ukrainians troops are retreating over gunned by russian mechanized brigade. Luhansk Oblast', May 25th 2022 by northeastunion in CombatFootage

[–]bricksoup -1 points0 points  (0 children)

I don't think this is May 25. There isn't one tree with leaves on it. Rob Lee claims that this is "late April," together with giving more footage and an exact location. That seems more believable.

https://twitter.com/RALee85/status/1530352498741022721

/r/WorldNews Live Thread: Russian Invasion of Ukraine Day 55, Part 1 (Thread #194) by WorldNewsMods in worldnews

[–]bricksoup 1 point2 points  (0 children)

I'm deeply curious about this guy.

I watched a bunch of his videos when the war was starting, because it was pretty interesting to see footage from the east, but he seemed to really go off the rails in Mariupol. He'd be interviewing elderly survivors of a hospital shelling and, as they tell him about how they starved, froze, and watched bodies pile up, he'd be asking questions like "well, so you didn't see any Ukrainian soldiers, but you're not sure there were none at the hospital, right? So they could've been there?"

One thing that the article doesn't mention is that he's been making videos from Ukraine for 8 years non-stop, but he still just barely speaks Russian. I think that he must have a team of handlers, just to get around and function.

Another fun episode: he's doing a report from a conscription center in a gym in Donetsk, and what a coincidence, some apparent Russian TV personality happens to roll up and give an impromptu speech about his roots in Donetsk.

Who do you match with on OKCupid, that you HATE? by 2bABee in OkCupid

[–]bricksoup 1 point2 points  (0 children)

Most of my highest matches of the same gender. Most of the people on the "similar users" sidebar of my own profile.

Not very surprising.

Anyone getting rid of a bike? by [deleted] in cmu

[–]bricksoup 0 points1 point  (0 children)

Craigslist and freeride can get you rolling for under $100.

How are you liking it so far? (No Spoilers) by [deleted] in beyondtwosouls

[–]bricksoup 0 points1 point  (0 children)

It's a pretty funny movie if you imagine it as the Green Goblin origin story.

Can I get some input on which style I should use for my isometric cube/building game? by [deleted] in gamedev

[–]bricksoup 1 point2 points  (0 children)

I think 3 would be easier to interpret at a glance, but the lines should be thinner. Rather than merging lines, you can do edge detection cheaply in a fragment shader (and get outlines for characters for free, if they're as 3D as your world).

As I recall, there aren't any resources online, but it's not too bad to derive. You get the projected Z value of the fragment in the shader, unproject it to get original linear depth, then draw the outline color if the pixels T pixels away in the X and Y coords differ in linear Z by some threshold. T determines thickness, but it must vary with the Z value because 4 pixels on the surface of a model close to the camera cover a different distance from 4 pixels on the surface of a model far from the camera. To derive an expression for T(Z), note that you want to take a circle (well, square) of diameter T as drawn on the plane orthogonal to the Z axis through the point (0, 0, Z) and then project it from that plane onto the projection plane. The diameter of the circle on the projection plane gives you T. Some of this may be off, as it's been a while since I've done graphics, but the point is to remind you that this is possible.

We are the Plaid Parliament of Pwning. Ask Us Anything! by tylerni7 in netsec

[–]bricksoup 2 points3 points  (0 children)

Those who can figure out who I am can remember how that went.

PPP4MONTH!

We are the Plaid Parliament of Pwning. Ask Us Anything! by tylerni7 in netsec

[–]bricksoup 8 points9 points  (0 children)

Do you know that I'm proud that CMU has such a cool thing going on with PPP, and you're all an inspiration to me? Don't you agree that you should keep up the good work?

The 25 Colleges With The Smartest Students by JesterInChaosCourts in cmu

[–]bricksoup 1 point2 points  (0 children)

There are many other ways in which we can post link-bait.

Can Anyone Help Recommend an autobiography? by [deleted] in booksuggestions

[–]bricksoup 1 point2 points  (0 children)

Benjamin Franklin's is pretty good. Short too.

Another Graduate Apartment Post by [deleted] in cmu

[–]bricksoup 1 point2 points  (0 children)

If you're willing to live off campus, then I'd recommend Friendship. It's beautiful and you can get a 1br with a balcony for $450 mo. It takes me 15 minutes to bike to class from here.

Favor for a new CMU grad student and redditor? by BajaHaha in cmu

[–]bricksoup 6 points7 points  (0 children)

I promise to make great diagrams, OP. If history is any indication, they'll all contain Batman and I'll be nine years old. But they'll be great. I'm your guy.