-
Notifications
You must be signed in to change notification settings - Fork 26
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
Maybe allow respondWith to take a promise-returning function? #40
Comments
I am hopeful that they'll advance at the next meeting (March 9), time permitting, or if time does not permit at the following one (April 19, the dates are weird because we tweaked the schedule this year). I have a concrete change to make (allowing If |
I know it's "old" but there's always
And truthfully I don't know how much people will want to be using inline things here. They'll probably call out to some method.
|
Sorry, I should have expanded my example; in most cases I want to use Your point about people calling out to a method is a good one, and makes me more comfortable doing nothing here except waiting for |
I encounter the same thing in service workers, and would happily make functions work here if no one objects. I have a vague memory of suggesting it before and folks weren't keen. |
Oh, if you can find that discussion @jakearchibald that would be great. Reading OP again |
Hm, I can't find a reference to it, maybe it was in-person or I'm making it up. |
Could we bring this back now that we have |
Yeah, it seems like TC39 is not moving very fast on this; I'm inclined to make this change across the web ecosystem for all promise-accepting arguments. |
Sure, and I would be a fan of it for |
Is the idea that it would take either a promise or function? I can't find any Would that be weird? It does seem like a platform API consuming or returning The alternative seemingly would be to permit |
Ah, damn: |
+1 for this. |
@bathos we would only apply it on the input conversion (i.e. ES to Web IDL), so that example is not an issue. |
I think I would prefer waiting a little longer with this, but either way, can we close this issue and open a follow-up against Web IDL? I hope there is agreement that it shouldn't be done for a single API. |
Sure: whatwg/webidl#1020 |
A lot of code examples I'm writing are of the sort
It'd be nicer if this could be written as
with the exact same semantics.
On the other hand, we haven't done this for other promise-accepting APIs on the platform (e.g. service worker's
waitUntil()
andrespondWith()
). Probably it's a bit too magic. (I'd be interested to hear if there were historical deliberations about this; /cc @jakearchibald @annevk.)The real solution here is async do expressions in the language (/cc @bakkot):
but
do
expressions seem to be one of those features which is really bad at getting through TC39's consensus model so I'm not sure it's a good idea to wait for them.The text was updated successfully, but these errors were encountered: