Last active
December 19, 2019 18:14
-
-
Save kallentu/96ac944929419eb1992ddeed97a776b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Reader<out T> { | |
// Compile-time error: Can't use 'out' type variable 'T' in an 'in' position. | |
T readableWritableValue; | |
// OK | |
final T readableValue; | |
} | |
class Writer<in T> { | |
// Compile-time error: Can't use 'in' type variable 'T' in an 'out' position. | |
T readableWritableValue; | |
// Compile-time error: Can't use 'in' type variable 'T' in an 'out' position. | |
final T readableValue; | |
} | |
class ReaderWriter<inout T> { | |
// Both OK | |
T readableWritableValue; | |
final T readableValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment