Remix.run Logo
mort96 2 hours ago

That approach doesn't allow you to move the file into some long lived object or return it in the happy path though, does it?

actionfromafar 2 hours ago | parent [-]

As someone coming from RAII to C#, you get used to it, I'd say. You "just" have to think differently. Lean into records and immutable objects whenever you can and IDisposable interface ("using") when you can't. It's not perfect but neither is RAII. I'm on a learning path but I'd say I'm more productive in C# than I ever was in C++.

mort96 2 hours ago | parent [-]

I agree with this. I don't dislike non-RAII languages (even though I do prefer RAII). I was mostly asking a rhetorical question to point out that it really isn't the same at all. As you say, it's not a RAII language, and you have to think differently than when using a RAII language with proper destructors.