so... 1.6-M1 is out
# random
f
so... 1.6-M1 is out
K 8
💯 2
n
What are the main highlights of this release?
d
Not much tbh. A lot of features have been put on hold until FIR is complete.
f
I saw that kotlin now has intersection types, with the very specific
T & any
. However, it's supported in the parser and in the compiler internally so it should be fairly simple to just lift that restriction...
👀 1
n
Are the Intersection types equivalent to Union types?
f
No, they are a different concept. They are 'the opposite' in some way. If A and B are groups, then A | B contains all elements that exist in A or B A & B contains all elements than exist in A and B So,
String | Int
is all Strings and ints, but
String & Int
is
Nothing
because nothing is both a String and an Int.
Comparable | Closeable
is any object that is comparable or closeable,
Comparable & Closeable
is any object that is comparable AND closeable.
T | any
: if T is nullable, then any non-nullable object, or a nullable instance of T. If T is not nullable, then it's equivalent to
any
.
T & any
: if T is nullable, then any non-nullable instance of T. If T is not nullable, then it's equivalent to
T
.
🆗 2