Was it really a Billion Dollar Mistake?

36 points by RaphGL


andrewrk

However, when you need to initialize each value of that slice, you are now turning a O(1) problem into a O(N) problem. And it can get worse if each field in the struct also needs its own form of construction.

It's still O(N) for the OS layer to memset to zero. O(2*N) is still O(N). Also you can just make your types optional that you want to zero initialize. Then you still get the computer to do what you want, and your type system reflects reality.

I'm obviously biased, but I don't sit around all day wondering if optionals were really such a good idea. I don't think about it at all because they're just so plainly a win-win to everyone who touches them. Odin is not 1.0 yet. Be brave! You can still change it!