https://kotlinlang.org logo
#random
Title
# random
f

Fudge

09/24/2021, 7:02 PM
so... 1.6-M1 is out
K 8
💯 2
n

napperley

09/24/2021, 10:32 PM
What are the main highlights of this release?
d

Dominaezzz

09/25/2021, 10:53 AM
Not much tbh. A lot of features have been put on hold until FIR is complete.
f

Fudge

09/26/2021, 11:23 AM
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

napperley

09/26/2021, 9:11 PM
Are the Intersection types equivalent to Union types?
f

Fudge

09/27/2021, 9:11 AM
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
2 Views