Skip to content

Instantly share code, notes, and snippets.

@baeharam
Created July 10, 2018 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baeharam/0cbdfd67eca1814a01f439f5f52606b9 to your computer and use it in GitHub Desktop.
Save baeharam/0cbdfd67eca1814a01f439f5f52606b9 to your computer and use it in GitHub Desktop.
typdeferror
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