I think that would just be Some[Int] \ Product (maybe the scala compiler can prove this is Nothing, but it's not a deal breaker either way)
-
-
-
Some[Int] is a Product, so if you forbid Product then nothing can satisfy Some[Int] right?
2 replies 0 retweets 1 like -
I concur, it's kinda how you can have `Int & String` it's also equivalent to `Nothing`, but the compiler can't necessarily check that
2 replies 0 retweets 0 likes -
Int & String is not equivalent to Nothing at all! They happen to have the same members, but they're very different types. Types are defined by their properties, and Int & String represents the union of the sets of properties of Int and String...
2 replies 0 retweets 0 likes -
Right, maybe we're talking about different equivalence relations. `Int & String` may not be `=:=` to Nothing, but sure as hell is isomorphic to it
2 replies 0 retweets 0 likes -
But it's not if you use that type as a bound, or for resolving an implicit, and types can be used in this way in Scala. It's only equivalent if you treat it as a set of values, and that's not what it is!
1 reply 0 retweets 1 like -
It seems like we might be agreeing?
Can you name me one use case where `Int & String` would be a useful type and `Nothing` wouldn't do?1 reply 0 retweets 0 likes -
I don't think so, unfortunately... it would be useful as the lower bound of an existential parameter to an invariant type which should accept String and Int as the parameter, but not much else. It will be inferred from, say, List(Ordering[Int], Ordering[String]).
1 reply 0 retweets 0 likes -
Replying to @propensive @LukaJacobowitz and
Now, you *could* use Nothing as the lower bound, but you would be losing type information when you don't need to, and it would allow you to have Orderings of any type in your List.
1 reply 0 retweets 0 likes
In general, when the compiler can't find a universal solution to a least upper-bound, it will infer an existential, bounded above by the LUB of the types, and bounded below by the GLB, which is the intersection type.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.