[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

So, how do you guys feel about "classes" in ECMA 6?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 1

File: 20130807-es6.png (3KB, 240x180px) Image search: [Google]
20130807-es6.png
3KB, 240x180px
So, how do you guys feel about "classes" in ECMA 6? Are you going to use them?
>>
>>52252787
They are just syntactic sugar, so nothing really changes.
>>
>>52252826
This

Cleaner code is always welcome.
>>
>>52252787
>Are you going to use them?
What do you mean? I'm never going to use ES6 because IE will never die, so no.
>>
>>52252787
>going to use
Babel.

>>52253272
>IE will never die, so no.
Again, Babel.

When using source maps, working with emerging JS features is a lot of fun. It's actually starting to feel like a real programming language at this point. Cleaner code (thanks to bits and pieces of syntactic sugar and modules), weapons against callback hell (promises), and all the rest are great for productivity. And thanks to transpilers, we don't have to worry about compatibility with all browsers of relevant adoption.
>>
>>52252787
I like them. Used them recently in a project (with Babel to convert).
it's just cleaner, better syntax for features that already existed
>>
>>52252925
>>52253501
What about arrow functions?
>>
>>52253524
Arrow functions are fucking awesome. Finally a solution for the
var that = this;
workaround.
>>
>>52253550
What??

That actually makes a difference?
>>
>>52253716
Arrow functions use the context in which they are defined, other than regular functions that have their own this, depending on which object they are bound to on invocation. It's not just syntactic sugar.
>>
>>52253803
I... guess that makes sense.
>>
>>52253836
It's really important to be aware of how scopes work if writing code that goes into production. I stopped being clueless after nearly causing significant financial damage. Fortunately, the problem was detected and fixed early enough after deployment.
>>
>>52253902
I do support for a living atm, so I won't break anything crucial... Most of my JS goes into managing in-house digital signage (a single self-updating webpage)
>>
Still no let block declaration
var a = 10;
let (b = a * 3) {
for (let i = 0; i < b; i++) {
console.log(i);
}
}


instead of

var a = 10;
{
let b = a * 3;
for (let i = 0; i < b; i++) {
console.log(i);
}
}
>>
>>52254248
I don't understand how this makes a difference. It may save you one line, but it could lead to dirty code for more than one assignment, such as:
var a = 10;
let (b = a * 3; c = b * 5) {
for (let i = 0; i < b; i++) {
console.log(i);
}
}
>>
No. I've been writing Javascript the same way for over a decade and some retarded internet hipsters decided to come fuck its shit up with all this CoffeeScript bullshit. They can take their ES6 standards and shove them right up their ass.
>>
>>52254800
For let blocks, you're showing a block of code that only belongs to the let declaration, instead of having to create your own block which makes code more difficult to read and ugly.

var a = 10;
let (b, c) {
b = a * 3;
c = b * 5;
for (let i = 0; i < b; i++) {
console.log(i);
}
}


Instead of the latter:
var a = 10;
{
let b = a * 3
for (let i = 0; i < b; i++) {
console.log(i);
}
}
}
>>
>>52254997
Whoops, I mean this:
var a = 10;
{
let b = a * 3;
let c = b * 5;
for (let i = 0; i < b; i++) {
console.log(i);
}
}
>>
>>52254997
The part that annoys me is the idea of being able to initialize a block variable on block declaration. If this is allowed, some idiot is going to come along with a 200 character let block declaration that initializes 20 variables in complex ways. Readability goes out of the window.

Don't get me wrong - what you're proposing is great, assuming only sane human beings use JS. From experience, however, every monkey with a typewriter is allowed to use it nowadays, so I would be cautious about adding syntax that could be easily be abused by a moron.
Thread posts: 19
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.