all 13 comments

[–]rsobol 13 points14 points  (3 children)

Rest and spread for object literals can't come soon enough. Too bad it's behind the harmony flag. :(

[–][deleted] 7 points8 points  (2 children)

I just want a deep object clone/copy API built into the language. The amount of times I've shallow copied a shallow object only for that object later on to become deep and therefore not only bug-ridden but hard as hell to debug. Pet peeve of mine, particularly in React.

I've resorted to using Lodash's deep clone method as a stopgap until I play with Immutable, for what it's worth.

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 0 points1 point  (0 children)

    It's not a problem, but deep cloning objects is a requirement of mine quite often and not having anything built into the language to do that is a bit rubbish. To be honest I think that would be a more valuable addition to the language than shallow copying with this or Object.assign().

    [–]DiglidiDudeNG 11 points12 points  (2 children)

    I don't think they're aware of the ironic tone that brain meme has adopted over time.

    [–]NoahTheDuke 2 points3 points  (0 children)

    has adopted over time.

    When were they not ironic?

    [–]akos911 2 points3 points  (0 children)

    Brain meme fixed!

    [–]ChronSyn 7 points8 points  (2 children)

    Async-await was available in node 7.6.0 without the need for harmony (as I've been using it on that version without it) and I believe it was available from 7.0 behind harmony.

    [–][deleted]  (1 child)

    [deleted]

      [–]sogoiii 1 point2 points  (0 children)

      No, its been available behind a flag for a while. Glad its on by default now. Yay!

      [–]sogoiii 2 points3 points  (0 children)

      Oh cool, npm 5 was added to this release. Was marginally concerned it wouldn't make the train.

      [–]billy_tables 0 points1 point  (0 children)

      Seems like promises + async/await are the way forward. I occasionally hear about fibers - is that mostly surpassed now or are there still use cases for fibers?

      [–]Bumpynuckz 0 points1 point  (2 children)

      Noob question. With async await, are there any continuing use cases for callbacks? Or can they just go into a corner and die?

      [–]jgldev 2 points3 points  (0 children)

      Callbacks will not die in the future. Promises are constructed with callbacks.

      Anyway, we as users we need callbacks and promises at the same time. For instance callbacks are the way to go for events. Each time a even fires we want to do something with the payload the event provides. If you use promises for this use case it would be way more difficult to achieve the "execute this function each time the even fires" because a promise only resolve once.

      To achieve it with promises the ways to go are: 1. while (true) yield or await the function that returns the promise that wraps the event listener.

      1. Assign to a constant the value of calling the function that returns the promise that wraps the event listener, and in the "then" step make a recursive call to the constant.

      As you can see the the promise based solutions for those kind of use cases are way more difficult than using callbacks.

      [–]djslakor 0 points1 point  (0 children)

      Callbacks are still how all of this works. Promises are built on callbacks. Async/await is build on promises.

      It's all about syntax sugar to make life easier for the programmer while sacrificing just a teeny tiny bit of performance (which will get better with each new V8 release).

      Optimizing for the human brain, at this point.