Hacker News new | ask | show | jobs
by blobs 2445 days ago
> The star of the show in optional chaining is the new ?. operator for optional property accesses.

Wow, that took a while! For already about 9 years this feature is in Coffeescript. And indeed it must be the star of the show because once you're used to that you almost can't live without it. Why did JS/ESxx never copied that idea?

edit: just read it has just been added to JS some days ago as well..

2 comments

This may feel a bit nit-picky, but they haven't been added to ECMAScript yet. There are two features here: the optional chaining operator[1] and nullish coalescing operator[2]. Both are at stage 3 of the standardization process.

Changes to proposed features can still be made at stage 3 if critical issues come up. Otherwise, once implementors have sufficient experience with them (and tests & multiple implementations exist) the proposals will be eligible to move to stage 4, after which they'll be able to be included as part of the next ECMAScript spec.

Both proposals are progressing through the process very smoothly, but I wouldn't rely on them for anything critical just yet.

[1] https://github.com/tc39/proposal-optional-chaining

[2] https://github.com/tc39/proposal-nullish-coalescing

Thats a good point. It is probably rare for proposals to change after stage 3 which is why the TypeScript team does not implement a ECMAScript feature until it reaches Stage 3.

In this case, members of the TS team were actually championing these ES proposals :)

As an aside... I am still a huge fan of Coffeescript as my main driver. I'm learning more about TypeScript and Rust, but Coffeescript remains my language for concision/expression :)

All of the above need method chaining, though:

https://en.wikipedia.org/wiki/Method_chaining