Why did Go creators choose to not treat nil
as false
? What why did they think it is better to explicitly compare values to nil
? Is there a reliable source that would explain why is that is Go? What was their opinion? What was the logic behind this decision?
I'm looking for a historical reference.
E.g.:
f, err := os.Open(name)
if err != nil {
return err
}
Than to implicitly cast nil
s to false
like in many other languages:
f, err := os.Open(name)
if err {
return err
}
As of now, the latter would give:
non-bool err (type error) used as if condition