livingcoder

joined 1 year ago
[–] livingcoder@programming.dev 6 points 3 days ago

The aliens haven't yet consumed our planet in this timeline. Consider yourself lucky.

[–] livingcoder@programming.dev 1 points 1 week ago* (last edited 1 week ago)

Even if you were using the builder pattern, this maintains the immutable variable in the parent scope while you use the mutable variable's builder pattern methods (basically exactly as my example demonstrates) in the inner scope.

edit: Oh, I think you mean you would chain the builder pattern calls and assign it to an immutable variable. Sure, that makes sense if you own the struct.

[–] livingcoder@programming.dev 2 points 1 week ago* (last edited 1 week ago) (2 children)

I prefer to encapsulate a mutable reference to the instance in a scope.

let post_form = {
    let mut post_form = PostInsertForm::new(
        // your constructor arguments
    );
    post_form.some_mutating_method(
        // mutation arguments
    );
    post_form
};

This way you're left with an immutable instance and you encapsulate all of the logic needed to setup the instance in one place.

[–] livingcoder@programming.dev 18 points 1 week ago (1 children)

Eternal Sunshine of the Spotless Mind

[–] livingcoder@programming.dev 3 points 2 weeks ago

I've literally sat down in city centers surrounded by buildings. It's an amazing feeling.

[–] livingcoder@programming.dev 20 points 2 weeks ago (3 children)

I wish I could experience that. I wish our sci-fi fairytales of space travel were happening now. Alas, I must simply exist in a life lived better than a king of old, living longer than our ancestors, with food untasted by the billions before us, and all while I fly around in space within Eve Online while watching Star Trek. Life is great, but it's so easy to want it to be just that much better.

[–] livingcoder@programming.dev 5 points 2 weeks ago (1 children)

What did he whisper in her ear?

[–] livingcoder@programming.dev 1 points 2 weeks ago

They say it just tastes better. idk. I'm going to try it soon.

[–] livingcoder@programming.dev 10 points 2 weeks ago (4 children)

Someone just suggested to me that I should be putting my chocolate bars in the freezer first. I've never heard of this, but apparently it's a thing that I've been missing out on for a while.

So I guess I'm the one who can't believe that I don't do it.

[–] livingcoder@programming.dev 2 points 1 month ago

I loved both of these games as a kid.

[–] livingcoder@programming.dev 3 points 1 month ago

There are some people who both start and end every gun debate with the "good guy with a gun" argument. Nothing gets through the impenetrable logic of "it makes sense to me".

view more: next ›