Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Last active August 29, 2015 14:16
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 tolmasky/12920f84747cfefb9149 to your computer and use it in GitHub Desktop.
Save tolmasky/12920f84747cfefb9149 to your computer and use it in GitHub Desktop.
Given object X
Given type A
if X isa A, BUT X.m isnot A::m
then I am unhappy.
For example (classical):
class A { func one() { return 1 } }
class B : A { func one() { return 2 } }
X = new B()
X isa A (true)
X.one !== A::one (true)
--> I'm unhappy.
For example (prototypal):
class A { func one() { return 1 } }
X.prototype = A;
X.one = func() { return 2 }
X isa A (true since X.prototype === A)
x.one !== A.one (true)
--> I'm unhappy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment