1. Take a *Vec3, using nil as the "optional is missing" value.
2. Take a Vec3, but consider some value as "invalid", often the 0-value as possible.
1 invokes exactly the issues in Hoare's essay. 2 doesn't work for all types, as some types don't have any bit pattern that are not useful, this is what I was trying to point out.
Additionally, a *Vec3 is more than `Vec3` or `null`. For example, the following code will behave very differently based on whether optionalVec is Vec3 or *Vec3.
optionalVec := Vec3{0, 0, 0}
foo(optionalVec)
fmt.Printf("theVec: %+v", optionalVec)
// would print {0, 0, 0} with an Optional[Vec3] type
// will actually print {2, 0, 0} with *Vec3
...
func foo(optionalVec *Vec3) {
if optionalVec != nil {
optionalVec.x += 2 //we use a different origin
}
[...]
}For my team, we would have loved to have something like C# (or even Java), with generics, exceptions, lambdas, LINQ/Streams etc., but with Go's low overhead and large ecosystem. Go the language was a major negative point, just not bad enough to outweigh the advantages of the runtime.