I posted this as an Issue in can-define but I bring it up here also to encourage a discussion.
https://github.com/canjs/can-define/issues/21
I find the Map.extend
signature and ones like it odd, where you have to move arguments around depending on how many you provide. I don’t think this is a common idiom in JS, and with ES6+ enhancements to the language it’s starting to feel very wrong.
I ALSO don’t like overloading functions, where different actions are taken depending on the type
of argument is passed: like in jQuery if you pass $() a function it’s invoked on DomReady, if you pass it a string selector it finds and wraps dom from the document, and if you pass it a string of HTML it creates DOM nodes.
I think overloading function like that is a relic of a pre-es6 module system where you could do like
import { querySelector, createDomNode, onDomReady } from 'jquery';
Anyway… I think we do a lot of that around CanJS too and maybe we could take this opportunity to embrace ES6 modularity and clean that up?
Thoughts? Flames? Props?