General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
p11
ThePrimeTime
comments
Comments by "p11" (@porky1118) on "You dont know OOP" video.
45:45 In Rust I sometimes want getters, which return modifiable state. It almost can't happen accidentally. And you would usuall call it `get_mut`. This immutable by default is such a nice feature. I'm so glad, I'm using Rust.
1
31:20 I use getters and setters in C# a lot. I often implement set like this: ```C# set { if (_foo == value) return; _foo = value; RefreshSomething(value); } ``` I get, why a method might be preferable. But there's some issue, becasue I use Unity: I use Events from the GUI, so if I turn it into a method, all these events just won't work anymore. I can fix it, but they don't cause compile time errors.
1
But I agree that you should not have getters, which don't just return the actual value. These already caused me some problems. The benefit of using computed getters is, that I only recompute the value, when I call the getter. But the issue is, that I always recompute the value, when I call the getter.
1
7:25 I recently created a C program, which has collections of methods that share a state. The struct is called `PnsNet` and the "methods are called `pnsNet_<method name>`, and the a pointer or const pointer to `PnsNet` as first argument.
1