Showing posts with label Rust. Show all posts
Showing posts with label Rust. Show all posts

Saturday, November 16, 2024

Thoughts on Rust - 2024 Edition

Here are some of my current thoughts on Rust, as initially prompted by a thread I saw this morning asking: "What features of Rust are most appealing to you?"

My reply follows.

~~~

Originally, what drew me most to Rust I guess were (in following order)


1) Complex compiled language with momentum that was not C++ 

This was by far the biggest motivation, back when I was still mostly a C/Python dev. Having spent a few years working professionally as a C++11 software engineer now (having learned on the job, thanks to working during code reviews with a bunch of top-notch Modern C++ gurus), it now just looks like Haskell-lite for Modern C++ devs  (which enforces all the best practices we generally do, *by default*).

 

2) Claims of speed + memory safety (esp around multithread type stuff - This was a big one coming from several bad Python codebases that struggled with really bad concurrency issues (i.e. random deadlocks on machines with different processor numbers than the original dev machines used), but also because Rust first started rising in prominence as I was looking into the Depsgraph stuff (which would have really benefited from being able to evaluate multiple things in parallel, to do background recalcs + caching of your scene)


3) Didn't have "cuddled else" / "caterpillar ifs" hard coded into the syntax (*cough* Go *cough*)

To this day, it still really annoys me running across code written that way. Like, really twitchy annoyed.

It's a real pity that there are a bunch of languages that hard enshrined it in their syntax (due to design decisions), and also that increasingly many examples across other C-like languages also do it. Ugh!


Wednesday, February 28, 2018

Struggles of a Rust Novice - Annoyances and Stumbling Blocks

Over the past few weekends, I've been spending time investigating more of the Rust language. Along with the web trifecta (HTML, CSS, JS) and OpenFrameworks, this is one of the things I've been meaning to spend some time learning/playing with this year.

It's a funny kind of language, as I've previous noted during my very brief foray into some simple things from last year) - On one hand, a lot of the concepts seem nice/vaguely familiar to stuff I've played with in other languages, making it sometimes feel deceptively easy to use. But then, you go to compile the code, and proceed to spend the next 30-60 minutes trying to find a way to convert various things into the right types that the compiler insists you need. Admittedly, it's quite frustrating work at times (see notes on String handling below), but, it pales in comparison to the blackhole and deranged hell that is web-based dev (i.e. CSS-based Layouts in particular - aaaaaaargh!!! Despite now having "CSS Flow" and "CSS Grid", it seems that CSS Layouts and I still don't get along very much at all). Faced with a choice between the two (and having just done experienced both back-to-back recently), I'd much rather face the Rust compiler anyday.

Anyway, to actually get a proper feel for the language this time, I decided to use this opportunity to bash together a little processing tool that I was going to need for another one of the many projects I'm working on atm:
That is, a tool to take XSPF playlists generated by VLC (and containing a carefully sequenced list of music I've composed/recorded over the past year), extract the filenames (and process them to unpack/extract-out the important identifying bits of metadata I was embedding in the filenames), and then spit all this info out into a more easily consumable format (e.g. JSON).  
Sure, I could've done this all in Python (though it lacks a XML library that just gives me the DOM element tree with no "namespace" tag mangling, etc.), or a mix of VLC + Python (i.e. saving out a m3u list - 1 line per track - then processing that in Python), but this way was going to be more fun (and a good way to throw something a bit meatier/realistic at Rust than the toy-examples I'd been playing with) :)


Hopefully the following post will be enlightening to some people out there - both other newbies stuck and struggling to get their heads around certain things they keep running into, but also for the Rust dev team in their self-professed "ergonomics drive" to lessen the humps that new devs face when learning Rust.

Sunday, January 8, 2017

First Steps with Rust

A few days ago, I suddenly got the urge to download Rust and have a little play around with it. Truth be told, I've been hearing some good things about it, and seeing as they now have a stable version out, I felt it was finally time to give it a little play around.

So far, I've played around with it for about 3 days. There's still a lot I don't know about the thing, but at the same time, I now have a decent feel for some "everyday aspects" of coding in this language.