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

Let it go. #83

Closed
pjasiun opened this issue Nov 3, 2015 · 9 comments
Closed

Let it go. #83

pjasiun opened this issue Nov 3, 2015 · 9 comments
Labels

Comments

@pjasiun
Copy link

pjasiun commented Nov 3, 2015

What do you think about replacing var with let? See https://hacks.mozilla.org/2015/07/es6-in-depth-let-and-const/ for details about differences.

We used to use var and used to quirks. But in 5 years our code with var may contains unneeded quirks which we will not be able to remove easily.

On the other hand var have better performance and let is not supported everywhere, but we could use Babel.

@oleq
Copy link
Member

oleq commented Nov 4, 2015

What do you think about replacing var with let?

It should be used where it matters. In loops to avoid unnecessary (function(){})() closures and the like. It's not like a choice whether use var or let – both have meaning and clear applications and must be used intentionally.

On the other hand var have better performance

Note that it will change. ES6 is something new in the web browsers and still things will get optimised, better and better. It's just a matter of time. Also note that it is DOM, that usually slows down the applications, not JS.

Besides, as I said in the previous response, it's up to the developer to decide whether to write things shorter of a little bit faster.

and let is not supported everywhere, but we could use Babel.

We must code using everything which is supported at the moment and update "old" code when the new ES6 features get implemented. Otherwise we'll never keep up with developing technology.

@Reinmar
Copy link
Member

Reinmar commented Nov 10, 2015

@Reinmar
Copy link
Member

Reinmar commented Nov 10, 2015

I'll create tickets in ckeditor5 and ckeditor5-core to convert the codebase to let/const.

In general, I would propose prohibiting using var unless you can come up with an example where you would like var's behaviour. I cannot.

@oleq
Copy link
Member

oleq commented Nov 10, 2015

Short but worth reading: https://medium.com/javascript-scene/javascript-es6-var-let-or-const-ba58b8dcde75

It's more or less what I meant in #83 (comment).

@pjasiun
Copy link
Author

pjasiun commented Nov 10, 2015

It's not like a choice whether use var or let

I do not like the idea of mixing var and let. It would be messy and the opportunity to make a mistake.

In general, I would propose prohibiting using var unless you can come up with an example where you would like var's behaviour. I cannot.

So 👍

@scofalik
Copy link

Okay. Should we rewrite everything that is on master and development branches?

@Reinmar
Copy link
Member

Reinmar commented Nov 10, 2015

Okay. Should we rewrite everything that is on master and development branches?

I will handle ckeditor5, ckeditor5-core and plugins. Then I'll ask you to update your branches. But not earlier, so we can have necessary discussions based on my changes. In other words – after my changes land on master branches, nothing "old" can be merged, so PRs and existing will need to be fixed before merging them.

@oleq
Copy link
Member

oleq commented Nov 10, 2015

Anyway, I found some interesting comment about let vs var http://programmers.stackexchange.com/a/274352.

@wimleers
Copy link

Love the issue title :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants