Andrew Gazelka
07/10/2019, 1:07 PMflowOf(1, 1.0, 2, 2.0)
)… don’t understand the &
elizarov
07/10/2019, 1:12 PM&
here reads as and
. The types here are comparable to any type that is Double
and Int
at the same time (such types don’t exist, but compiler does not check that) and extend Number
.Marc Knaup
07/10/2019, 1:24 PMNumber
?diesieben07
07/10/2019, 1:25 PMComparable<Double & Int>
is more precise than Number
Marc Knaup
07/10/2019, 1:42 PMDouble & Int
is impossible? A type cannot be both at once.
Comparable<Double | Int>
would make sense to me.diesieben07
07/10/2019, 1:50 PMkarelpeeters
07/10/2019, 1:51 PMcompareTo
I need to give sometime that is both an Int
and a Double
for it to work. Obviously that's impossible, but the type system doesn't know that.Marc Knaup
07/10/2019, 1:59 PMdiesieben07
07/10/2019, 1:59 PMMarc Knaup
07/10/2019, 2:03 PMkarelpeeters
07/10/2019, 2:04 PMInt & Double
does make sense, Int | Double
wouldn't.Marc Knaup
07/10/2019, 2:11 PMNumber
is Comparable
but it isn't.
So the initial type basically reads
this is a Number which is Comparable but you can't actually use generic elements of Comparable because the possible type arguments are disjoint up to but excluding(AnyNumber
out
may work as karelpeeters
07/10/2019, 2:12 PMAny
doesn't work either. Nothing
does 😒imple_smile: But yeah, that what it means.Marc Knaup
07/10/2019, 2:13 PMHullaballoonatic
07/11/2019, 6:11 AM&
syntax for type parameters instead of where
syntax, JB!elizarov
07/11/2019, 6:55 AM