Re: [w3c/webcomponents] The is="" attribute is confusing? Maybe we should encourage only ES6 class-based extension. (#509)

@oleersoy I totally agree what @WebReflection said. I only want to add comment about "default export". 

Note, my comment is off-topic (we should discuss it in some repo under tc39 instead of w3c), but you alway use it as a evidence in the discussion, so I must point out that I totally disagree your criticism to default export in ES2015+.

1. Default exports is nothing special, `import x from ...` is just a syntax sugar of `import {default as x} from ...`, so your judgment of it is harmful to refactoring can NOT be true. If IDE/tools did it wrong, they would also failed in the normal exports (at least in the cases of alias).

2. IDE/tools can also do heuristic auto import for "default export"s by matching the name of default exports (normally classes and functions would have name) or the filenames (eg. `parseFile` would match `path/to/parse-file.js` if it has a default export).

3. Yes someone may misuse default export to a huge object instead of multiple exports, just like misuse any language feature. What you really need is education, not ban the feature. And it could make tree shaking harder, but ideally a good enough tree shaking tool can also analysis it and know you only need one property on the export object, and eliminate the other part.

Summary: Default export may cause problems if your IDE/tools was not good enough and/or the education to your team members for this feature was not enough. Obviously, they are solvable. So as language spec perspective, nothing is wrong.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/509#issuecomment-402922650

Received on Friday, 6 July 2018 04:32:01 UTC