Skip to content

Instantly share code, notes, and snippets.

/promise.md Secret

Created August 25, 2016 02:27
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 anonymous/ecf9ae41e58e8d9a9d6de8ecdb3c340f to your computer and use it in GitHub Desktop.
Save anonymous/ecf9ae41e58e8d9a9d6de8ecdb3c340f to your computer and use it in GitHub Desktop.
  • Defs:

      1. O: All objects
      1. P: All objects following the official spec
      1. T: All objects with the method then
      1. f(x). Return true iif x ⊆ P
      1. g(x). Return true iif x ⊆ T
    • 6 eval(x). x ⊆ P iff x resolves in the future
    • 7 eval(x). x !⊆ P iif eval fails
  • Test using g(x)

    • Goal: { f(o) = g(o) | o ⊆ O }
    • Try: o = {then() {}}, o ⊆ O, f(o) ≠ g(o)
    • Conclusion: Fails
  • Test using eval(x)

    • Goal: { eval(o) | o ⊆ O }
    • Try: x = {then() { sleep(inf) }}, eval(x) never terminates. Fallback proof: "the halting problem"
    • Conclusion: Fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment