4 ms·
I just checked and can't really make sense of why Option extends Product, so it's probably not for me. http://www.scala-lang.org/api/current/scala/Option.html
by swah 15y ago
I just checked and can't really make sense of why Option extends Product, so it's probably not for me.
http://www.scala-lang.org/api/current/scala/Option.html http://www.scala-lang.org/api/current/scala/Option.html
- swift 15y agoYeah, neither can I, that's really bizarre. Shouldn't it extend Sum? (which doesn't appear to exist) Can anyone familiar with this design decision shed light on this?
- quatrevingts 15y agoOption is implemented only by the two case classes Some and None. All case classes implement Product automatically. Having Option extend Product allows access to these methods from variables with the static type Option. I'm having a hard time thinking of a use for the Product interface to Option, but I suppose it might as well be allowed since it is implemented anyway.