Created
July 10, 2018 04:29
-
-
Save baeharam/0cbdfd67eca1814a01f439f5f52606b9 to your computer and use it in GitHub Desktop.
typdeferror
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 SortedCollection { | |
Function compare; | |
SortedCollection(int f(Object a, Object b)) { | |
compare = f; | |
} | |
} | |
// Initial, broken implementation. | |
int sort(Object a, Object b) => 0; | |
void main() { | |
SortedCollection coll = SortedCollection(sort); | |
// All we know is that compare is a function, | |
// but what type of function? | |
assert(coll.compare is Function); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment