Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The wavy-dot may encourage unnecessary chaining promise #11

Open
JLHwung opened this issue Nov 13, 2020 · 0 comments
Open

The wavy-dot may encourage unnecessary chaining promise #11

JLHwung opened this issue Nov 13, 2020 · 0 comments

Comments

@JLHwung
Copy link

JLHwung commented Nov 13, 2020

If we would like to access deep properties of the resolved data

await p.then(t => t.a.b)

we could use (await p~.a).b. But it is ideal because if .b throws, the error will be thrown at a different frame.

However, users may find out, await p~.a~.b, which seems neater than (await p~.a).b, also work because it can desugar to

await p.then(t => t.a).then(s => s.b)

By this way the wavy-dot could encourage unnecessary chaining promise. The broader question, as I mentioned in tc39/proposal-eventual-send#18, is that the wavy dot, while provides convenience to chain promise, limits the syntax operation that you can perform on the retrieved data. In this case the data access have to be separated into another execution frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant