Async property accessor: ->

The idea is to access a property of an awaited value to allow deep chaining of async operations.

Right now, to accomplish that kind of chaining you need to write:

const baz = await (await (await fetchFoo()).fetchBar()).fetchBaz();

That can get pretty awkward pretty fast. My idea is a new operator that accomplishes this without all the nested parens:

const baz = await fetchFoo()->fetchBar()->fetchBaz();

Additionally, they can be optionally chained like the other property accessors:

const baz = await fetchFoo()?->fetchBar()?->fetchBaz();

I figured that -> seems appropriate for a new property accessor operator, as it's used by other languages like C++ as a way to access a property.

This operator would only be available in an async scope, since it's essentially a shorthand for await.



Wonderful! I'm seeing now that it's in stage 1. That syntax would be amazing. Fingers crossed!