Skip to content

Docs: Default es6 features should clarify type of Spread operator #653

Closed

Description

@batjko

Hi guys,

When I read through this list of features shipped by default:
https://nodejs.org/en/docs/es6/#which-features-ship-with-node-js-by-default-no-runtime-flag-required
... I thought it great that the Spread operator is now supported without any flags.

So I went and tried the spread operator on an object and was promptly met with an Unexpected token ... error, despite having node v5.10 installed.

I then had to be educated by StackOverflow that it is only the Array spread operator that is supported, but not the Object spread operator.

I think this should be clarified on the page.

Many thanks.

Activity

  1. changed the title [-]Default es6 features should clarify type of Spread operator[/-] [+]Docs: Default es6 features should clarify type of Spread operator[/+] on Apr 16, 2016
  2. lpinca commented on Apr 18, 2016

    @lpinca
    Member

    I've filed a pr for this, but I think the issue is invalid. The feature is not part of ES2015.

  3. batjko commented on Apr 18, 2016

    @batjko
    Author

    The issue isn't about whether object spread operators are included in ES2015 or not.
    It's about the phrase "Spread Operator" being ambiguous for anybody who doesn't know off the top of their head what is or isn't part of any given standard.

    When I look at a list of supported features in my version of node, I don't care if it is in ES2015 or ES2017. I just want to know if I should be able to use it or not.

    Thanks for the PR, @lpinca.

  4. fhemberger commented on Apr 18, 2016

    @fhemberger
    Contributor

    @lpinca There is an open issue to rename that page to "ES6 and beyond", so it's still okay.

  5. lpinca commented on Apr 18, 2016

    @lpinca
    Member

    Ok.

  6. stevemao commented on Apr 20, 2016

    @stevemao
    Contributor

    Closing as #661 is closed

  7. batjko commented on Apr 20, 2016

    @batjko
    Author

    I don't understand why the related PR was getting rejected. I don't see why adding a little note to clarify that object spread operators are not supported, is so controversial that it must not be pointed out to readers seeking information about it.

  8. stevemao commented on Apr 20, 2016

    @stevemao
    Contributor

    Reason already stated in the PR.

  9. MylesBorins commented on Apr 20, 2016

    @MylesBorins
    Contributor

    @batjko the reason is that v5 will be end of life once v6 is released next week, which has better support for the spread operator. If we added the change we would have to revert it next week

  10. lpinca commented on Apr 20, 2016

    @lpinca
    Member

    Actually the note was generic enough to not include the fact that spread operator did not work on destructuring assignments. Destructuring in not available in node 5 anyway.

    The reason is that spread operator documentation already makes it clear that it only works on array literals, function calls and destructuring so the note is redundant imho.

  11. lpinca commented on Apr 20, 2016

    @lpinca
    Member

    Also as @fhemberger stated above, there is an ongoing work to create an "ES6 and beyond" page that should replace the current "ES6 in Node.js" page.
    That seems a better place to put notes about future features of the language.

  12. batjko commented on Apr 20, 2016

    @batjko
    Author

    Ah, Another thing I wasn't aware of, @thealphanerd . That of course makes total sense to me.

    I suppose my concern was simply that the generic phrasing simply assumes that everyone keeps closely up-to-date with all features and at which stage of their discussion / implementation they are at any given point.

    A lot of people just don't have the time to do that, so clarity is always preferable to "you should have read these other documents".

    But either way, it's going to be brought up-to-date with v6 anyway, so it's all good.
    Thanks everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions