4 ms·
If you add nil checks to each receiver method, potentially, you are adding thousands of unnecessary branches to your program. It would be quite inefficient. You
by tirrex 6y ago
If you add nil checks to each receiver method, potentially, you are adding thousands of unnecessary branches to your program. It would be quite inefficient. You will ruin performance & readability altogether.
Better way is what you described, accept nil state as invalid, require user to handle it (user must initialize before using your method)