News for hackers. Stuff that matters.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by brobinson on Sunday September 04, 2016 @09:56PM (#12427660)
Go effectively has Option types for database query results: https://golang.org/pkg/database/sql/#NullBool
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by unscaled on Sunday September 04, 2016 @10:15PM (#12427724)
This is not a generic option type, but rather a tri-state bool, or an Option<bool>. Go has no user-defined generics, so you can't have a bool type. It does have built-in "magical" generics, namely arrays, slices maps and channels, but no option/maybes. Language-level option types are not unheard of (C#, Swift and Kotlin all have a notion of this sort, although they all support proper user-defined generics as well).
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by masklinn on Monday September 05, 2016 @05:54AM (#12429211)
> Language-level option types are not unheard of (C#, Swift and Kotlin all have a notion of this sort)

Swift's Optional is a library type: https://github.com/apple/swift/blob/master/stdlib/public/cor...

Though the compiler is aware of it and it does have language-level support (nil, !, ?, if let)