mastodon.gamedev.place is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server focused on game development and related topics.

Server stats:

5.5K
active users

Andrew Plotkin

What I’m finding is that Rust has fallen into the same basic nerd-trap as Lisp. It makes you think that by writing tidier, cleaner, more functional code, you’re becoming a better person. In fact you’re just functoring off.

I just “condensed” a perfectly readable for loop into this:

let scripts: Vec<Script> = opts.script
.iter()
.map(|filename| load_script(&filename))
.collect::<Result<Vec<_>, _>>()?;

For the record, the first version looked like this:

let mut scripts: Vec<Script> = Vec::new();

for filename in &opts.script {
let script = load_script(&filename)?;
scripts.push(script);
}

But, you know, that’s code for _humans_.

(This is a learning project. I am intentionally kicking the tires here.)