News for hackers. Stuff that matters.
Re:Replacing Clever Code with Unremarkable Code in Go by masklinn on Wednesday June 05, 2013 @05:18AM (#5824442)
> What I get from your comment is that option types work well in Haskell and Scala. This doesn't surprise me, as both languages places a strong emphasis on the type system, and so they are easily supported.

Option types need no type system support beyond having option types at all. Think of an option type as a container. It's either empty, or it has a single element inside it.

You can manipulate your container by checking if it's empty, getting the value out, manipulating the value and putting the value in a new collection. That's the basic low-level primitives of interacting with an option type.

And you can also use higher-order operations, e.g. map over the collection which will only "do things" if there's a value and will just return an empty collection if there isn't. These are the higher-level combinators on option types. They require no type system complexity outside of having option types in the first place.

Re:Replacing Clever Code with Unremarkable Code in Go by mietek on Wednesday June 05, 2013 @08:34AM (#5825133)
Yes. Also, these low-level primitives already exist in Go, as support for pointers, or references. The missing bit is requiring references to be explicitly annotated as nullable or non-nullable.