Hyperapp: What about using ES6 features?

Created on 10 Dec 2017  路  5Comments  路  Source: jorgebucaran/hyperapp

http://node.green/ (99% from v6.12.2 to 10.0.0 nightly)
https://caniuse.com/#search=es6 (~85% features of es6 are supported in most popular browsers)

pros

  • reduce size
  • performance (in any cases)
  • can be transpiled if it really necessary (old browsers)

cons

  • in some envs we should use transpilation step (but it needs for some external libs anyway)

Please :+1: if you like it and :-1: otherwise.

Discussion Wontfix

Most helpful comment

Let me clarify: I would love to rewrite hyperapp in ES6 and say to hell with old browser support, but there's more to lose than to win by doing it. So, I'm going to wait until the day we can and then do it! 馃槃

All 5 comments

@dmitry-vakhnenko What ES6 features do you want to use?

Hyperapp is already written in ES6 because we are using ES module syntax, and as such, you can use it as an ES module out of the box without compilation.

Hyperapp also works on IE10 and according to @Alber70g on IE9 too, again no compilation needed.

Rewriting the library in ES6 would be fun, but would force me to introduce a compile step, which is unnecessary complexity and I don't want to depend on one. I know most people compile their apps anyway, I do too, but those are actual apps. Hyperapp on the other hand is so simple, you can use it as is.

reduce size

Only if we distribute the minified source code, but that would be too limiting. I don't know of any libraries that do that.

performance (in any cases)

Which cases? 馃

can be transpiled if it really necessary (old browsers)

It needs to be transpiled for us so that our CDN bundles are compatible with older browsers. I already explained why I don't want to introduce a compile step above.

Now, the good news is that someday I'll be able to ship hyperapp using only ES6. That will be the day when we decide to stop supporting IE11. 馃帀


EDIT: I've closed and tagged this as _wontfix_, but we can continue talking about the subject if you have further questions or want to discuss something else.

array functions fastest > functions(){} because they didn't create context
and
https://jsperf.com/spread-vs-arguments/1

upd:
https://jsperf.com/merge-vs-assign/1

@dmitry-vakhnenko

  • arrow functions are faster: You are probably right, but they are not supported on IE11.

  • spread-vs-arguments: same on firefox, spread wins on chrome. However, this is really JSX fault. See #462.
    screen shot 2017-12-10 at 22 46 46

  • merge-vs-assign: merge was faster on firefox and in chrome because your test case was wrong, Object.assign(a,b) mutates a. Our merge is immutable, so it's like Object.assign({}, a, b).

screen shot 2017-12-10 at 22 45 10
screen shot 2017-12-10 at 22 51 18

Iam sorry. thanks :+1:

Let me clarify: I would love to rewrite hyperapp in ES6 and say to hell with old browser support, but there's more to lose than to win by doing it. So, I'm going to wait until the day we can and then do it! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zaceno picture zaceno  路  3Comments

zhaotoday picture zhaotoday  路  3Comments

jbrodriguez picture jbrodriguez  路  4Comments

dwknippers picture dwknippers  路  3Comments

jorgebucaran picture jorgebucaran  路  4Comments