Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@matthewstokeley
Last active October 23, 2019 09:18
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 matthewstokeley/87a41f53c30c84d4bdef51b9e12c47ef to your computer and use it in GitHub Desktop.
Save matthewstokeley/87a41f53c30c84d4bdef51b9e12c47ef to your computer and use it in GitHub Desktop.
Prototype mutability wip

Object or Function prototype mutability is unintuitive, like a key that returns a different letter on each keypress. This points to one of the reasons why patterns like virtualization via proxies and reflection, functional programming's eschewal of side effects, and reactive vue-style object mutation events are commonly used, especially in conjunction with composition techniques.

That is, we expect Function.prototype.apply to invoke a function given context and an array of parameters. We can easily change the method - Function.prototype.apply = ( fn ) => { console.log( fn ) } - it is expectations that are difficult to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment