4 ms·
True, but even then you only have to decide between passing a copy of the value or a reference to it, no need to think about ownership.
by tsimionescu 5y ago
True, but even then you only have to decide between passing a copy of the value or a reference to it, no need to think about ownership.
- pjmlp 5y agoKind of, if it is a struct with destructors you need to ensure a region exists. So either do something like using MyStructType something = new MyStructType () Or a more FP like stuff with myVar.WithXYZResource(res => { /* .... */ }) And then consider if it should be a ref struct, so that is only stack allocated. This from C# point of view, in something like D, there would be another set of considerations. Still much easier than "in your face ownership management" though, yes.
- tsimionescu 5y agoWell, destructors come up if you have non-memory resources to manage, and there you do go back to ownership and deterministic destruction issues.