Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we refactor for ES6? #6

Closed
morris opened this issue Oct 28, 2020 · 4 comments
Closed

Should we refactor for ES6? #6

morris opened this issue Oct 28, 2020 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@morris
Copy link
Owner

morris commented Oct 28, 2020

No description provided.

@morris morris added the help wanted Extra attention is needed label Oct 28, 2020
@sperretcraft
Copy link

sperretcraft commented Oct 28, 2020

Would love to see a version with ES6 ! And why not with Typescript (I read your comment on HN saying you'd use it if build steps were allowed)
I think your work would be even more interesting if closer to real uses of Vanilla in 2020 (with a lot of builder framework available and Typescript broadly used).

Great work anyway. Would love to see more.

P.S. I'm not fluent enough in JS to help you going forward >.<

@perfectsquircle
Copy link

I took a crack at it because I haven't played with native modules much and I was curious.

Here is the diff set: main...perfectsquircle:feature/es6

I started by running Lebab to take care of the boilerplate changes.

lebab --replace public/scripts --transform \
arrow,\
arrow-return,\
obj-method,\
obj-shorthand,\
for-of,\
for-each,\
let,\
template
# destruct-param <-- interesting changes, but broke some things

Then I converted everything on the global VT object into modules. It was actually very easy because everything was already scoped nicely.

My takeaway: it's interesting to note the differences, but maybe it should exist only as a fork for comparison sake? The original art is interesting because of the hard constraints.

In the readme you state

considerable duplication (most of which may be mitigated by ES6)

I'm curious what ideas you had for this.

@morris
Copy link
Owner Author

morris commented Oct 29, 2020

Thanks for your effort @perfectsquircle - looking good although missing some steps (convert HTML string arrays to template literals, simplify one-line functions e.g. () => { call(); } to () => call()).

I remember not being super happy with the wording

albeit verbose and with considerable duplication (most of which may be mitigated by ES6)

and I should change it; ES6 does reduce verbosity, and therefore the duplication may hurt less, but it's structurally the same duplication. That can only be solved through helpers (as far as I can tell).

In any case I agree with you, I think it made sense to hit "rock-bottom" at least once with ES5. I'm inclined to keep it as it is and let an ES6 version be a fork or a branch just for reference. I'll keep this discussion open for a while and see if there's more demand. If you want to progress on your ES6 fork, feel free, would be interesting to see exactly how much simpler it gets :) thanks again!

@morris
Copy link
Owner Author

morris commented May 9, 2022

1.5 years later... done :)

@morris morris closed this as completed May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants