Skip to content

Instantly share code, notes, and snippets.

Last active October 22, 2022 15:46
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Copy link

david-mark commented Dec 11, 2016

jQuery is hell and gone from any sort of architecture like this. They need to start by avoiding ill-advised "overloading" and the crutch methods (e.g. isPlainObject, isWindow), etc. that come with it.

It's about plug-ins, not "subclassing". Quotes indicate there are no classes in ECMAScript (just as there is no real concept of "overloading" in a loosely typed language), though TypeScript provides for such semantics. I prefer to implement such schemes in pure ECMAScript, despite a few warts in associated support functions (e.g. inherit in My Library). YMMD.

Copy link

mlhaufe commented Dec 11, 2016

#1 - ECMAScript 6 supports classes: Ref. Though it is still prototypical inheritance.

#2 - I'm not sure what you mean by "plug-ins"

#3 - Being "loosely typed" does not preclude overloading. It's simply syntactic sugar. Mozilla has a non-standard implementation of JavaScript which supports a form of this: Conditional Catch Clauses Also, you can see an example in Lua

I'd be curious to see what Jessie/MyLibrary looks like after you migrate to ES6 and modules.

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