762:
330:
605:
574:
673:
253:
232:
697:
1027:
1006:
201:
1261:
Conversely, because each await expression operates on a promise but sits inside a function, the operation of the function itself can proceed by waiting on each promise in turn. Code structures like loops can contain await expressions inside them, allowing the loop to suspend and resume later on. This
1150:
I went ahead and added a rough draft explaining the async/await feature. I haven't cited any sources yet (though most of the information can be sourced by C#'s official documentation on the subject as well as Eric
Lippert's .NET blogs) and haven't honed down appropriate pages for the dead links, but
1236:
Because an async-annotated function always returns its result via a promise, it is permitted to use an await expression within it. The first time the function is required to suspend because of an await expression on an unresolved promise, it can return an unresolved promise of its own to its caller
1224:
keyword operates on an expression that provides a promise and pauses execution of the containing function if the result of that promise is not yet available. The function remains suspended until the promise is fulfilled, at which point the function will resume execution. The await expression itself
1170:
I added a "Benefits and
Criticisms" section in order to provide room for quotes from well-renowned CS experts on the async/await pattern. Currently, the article reads with just a factual description of the subject that leans a little too much on its promised benefits, but I do remember reading
783:
351:
1253:
method it is possible to chain a sequence of operations together one after another, more difficulty comes in trying to express patterns like repeating loops, iteration over a list, or perform nested conditional operations. Because the body of each
1103:
The article doesn't describe the flow of control executed by an await command. It only describes what it doesn't do, then goes right into implementation details. I've read the article twice and still have no idea what "await" does.
1232:
keyword annotates the definition of a function and has two effects. It permits the body of the function to use an await expression, and it alters the return type or value of the function, so that it is wrapped in a promise.
1171:
criticisms of this pattern when it was newer, such as a complaint that it overtakes your program like a "zombie virus". I don't have time to research this myself, so could someone else add a few of these?
163:
1081:
1262:
leads to a much more natural way to write promise-driven code, because the programmer can use the familiar language features of control flow even when dealing with promise-based asynchronous behaviour.
1209:
The async/await pattern is usually expressed in the form of two additional keywords, named async and await, which interact with values of a type used to represent a deferred operation, often called a
1326:
1111:
807:
375:
947:
515:
1305:
More and more languages have adopted coroutine, so do compiler implementations. In section 8, "In C++", I believe the statement "GCC still has no support for it" need update. See
1384:
864:
802:
432:
370:
303:
1125:+1. I saw the same problem; the article gives examples and implementation, but not an explanation of what the feature actually does; what all the examples have in common.
1354:
711:
293:
1359:
1258:
invocation has to be a self-contained function in its own right, syntactical structures like loops or conditionals cannot span multiple promise-based operations.
269:
157:
663:
89:
1369:
1349:
909:
653:
477:
1379:
687:
1404:
1071:
724:
706:
588:
316:
260:
237:
95:
883:
629:
451:
1409:
855:
423:
1047:
972:
540:
40:
836:
404:
1364:
54:
1330:
1374:
1115:
612:
579:
109:
1399:
682:
584:
114:
30:
1034:
1011:
84:
1394:
1140:
928:
496:
1190:
I wonder if the page would be improved by the following explanation of the syntax from a fairly language-neutral perspective.
893:
774:
461:
342:
212:
1389:
817:
385:
75:
938:
506:
268:
related articles on
Knowledge (XXG). If you would like to participate, please visit the project page, where you can join
903:
471:
178:
1290:
145:
119:
965:
533:
1046:
topics on
Knowledge (XXG). If you would like to participate, please visit the project page, where you can join
1039:
1151:
it's a start. Would you say it helps clarify the issue more clearly than the previous version of the article?
874:
442:
218:
1275:
1176:
1156:
1322:
1128:
1107:
625:
1136:
65:
1286:
628:
on
Knowledge (XXG). If you would like to participate, please visit the project page, where you can join
1172:
1152:
139:
80:
1132:
793:
361:
200:
171:
1191:
135:
1271:
1195:
61:
919:
487:
185:
845:
413:
265:
1245:
The async/await syntax can be seen as a development from earlier techniques, such as the
1213:
or future. While use of these two terms often varies from language to language, the word
1313:
761:
329:
784:
Requested articles/Applied arts and sciences/Computer science, computing, and
Internet
352:
Requested articles/Applied arts and sciences/Computer science, computing, and
Internet
1343:
1309:
1270:
Who invented it and when? What is the timeline of adoption in the various languages?
151:
1317:
1237:
thus providing a mechanism to eventually yield its result when it resumes again.
34:
672:
604:
573:
17:
826:
621:
394:
696:
252:
231:
617:
1026:
1005:
1210:
1334:
1294:
1279:
1199:
1180:
1160:
1144:
1119:
1043:
902:
Find pictures for the biographies of computer scientists (see
470:
Find pictures for the biographies of computer scientists (see
194:
25:
695:
671:
750:
745:
740:
735:
170:
1038:, a collaborative effort to improve the coverage of
616:, a collaborative effort to improve the coverage of
264:, a collaborative effort to improve the coverage of
184:
808:Computer science articles needing expert attention
376:Computer science articles needing expert attention
43:for general discussion of the article's subject.
948:WikiProject Computer science/Unreferenced BLPs
516:WikiProject Computer science/Unreferenced BLPs
8:
278:Knowledge (XXG):WikiProject Computer science
1385:C-Class software articles of Mid-importance
1285:This would be good to have in the article.
1249:method in JavaScript and C#. While using a
1217:will be used in the following description.
865:Computer science articles without infoboxes
803:Computer science articles needing attention
433:Computer science articles without infoboxes
371:Computer science articles needing attention
1320:
1126:
1105:
1000:
769:Here are some tasks awaiting attention:
719:
568:
337:Here are some tasks awaiting attention:
311:
226:
1355:Mid-importance Computer science articles
1327:2603:6010:8202:5901:3F0F:D4BD:99CB:5C67
1002:
570:
228:
198:
1314:Summaries of current compiler support
1225:will yield the result of the promise.
1112:2602:304:B390:1700:B159:7D37:18B8:9E75
1360:WikiProject Computer science articles
638:Knowledge (XXG):WikiProject Computing
281:Template:WikiProject Computer science
7:
1032:This article is within the scope of
610:This article is within the scope of
258:This article is within the scope of
217:It is of interest to the following
33:for discussing improvements to the
884:Timeline of computing 2020–present
452:Timeline of computing 2020–present
24:
1370:Low-importance Computing articles
1350:C-Class Computer science articles
1166:"Benefits and Criticisms" section
1056:Knowledge (XXG):WikiProject C/C++
910:Computing articles needing images
478:Computing articles needing images
60:New to Knowledge (XXG)? Welcome!
1380:Mid-importance software articles
1025:
1004:
760:
603:
572:
328:
251:
230:
199:
55:Click here to start a new topic.
1076:This article has been rated as
658:This article has been rated as
298:This article has been rated as
1318:Compilable and executable demo
641:Template:WikiProject Computing
1:
1405:Mid-importance C/C++ articles
1301:Language and Compiler Support
1050:and see a list of open tasks.
964:Tag all relevant articles in
704:This article is supported by
680:This article is supported by
632:and see a list of open tasks.
532:Tag all relevant articles in
272:and see a list of open tasks.
52:Put new text under old text.
1295:17:41, 31 October 2019 (UTC)
1280:17:27, 30 October 2019 (UTC)
973:WikiProject Computer science
725:WikiProject Computer science
707:WikiProject Computer science
541:WikiProject Computer science
317:WikiProject Computer science
261:WikiProject Computer science
1200:16:05, 20 August 2019 (UTC)
1145:16:34, 18 August 2017 (UTC)
904:List of computer scientists
472:List of computer scientists
1426:
1410:WikiProject C/C++ articles
1365:C-Class Computing articles
1120:15:53, 21 March 2017 (UTC)
1059:Template:WikiProject C/C++
664:project's importance scale
304:project's importance scale
1375:C-Class software articles
1335:16:29, 23 June 2021 (UTC)
1181:15:53, 24 July 2018 (UTC)
1161:23:51, 23 July 2018 (UTC)
1075:
1020:
966:Category:Computer science
718:
703:
679:
657:
598:
534:Category:Computer science
310:
297:
284:Computer science articles
246:
225:
90:Be welcoming to newcomers
968:and sub-categories with
536:and sub-categories with
1186:Possible added sections
1400:C-Class C/C++ articles
1395:All Computing articles
1266:Invention and adoption
929:Computer science stubs
700:
676:
626:information technology
497:Computer science stubs
207:This article is rated
85:avoid personal attacks
1390:All Software articles
699:
675:
613:WikiProject Computing
211:on Knowledge (XXG)'s
110:Neutral point of view
723:Things you can help
683:WikiProject Software
315:Things you can help
115:No original research
701:
677:
644:Computing articles
213:content assessment
96:dispute resolution
57:
1337:
1325:comment added by
1147:
1131:comment added by
1122:
1110:comment added by
1096:
1095:
1092:
1091:
1088:
1087:
1035:WikiProject C/C++
999:
998:
995:
994:
991:
990:
987:
986:
567:
566:
563:
562:
559:
558:
555:
554:
193:
192:
76:Assume good faith
53:
1417:
1287:BernardoSulzbach
1257:
1252:
1248:
1082:importance scale
1064:
1063:
1060:
1057:
1054:
1029:
1022:
1021:
1016:
1008:
1001:
977:
971:
846:Computer science
775:Article requests
764:
757:
756:
720:
646:
645:
642:
639:
636:
607:
600:
599:
594:
591:
576:
569:
545:
539:
414:Computer science
343:Article requests
332:
325:
324:
312:
286:
285:
282:
279:
276:
275:Computer science
266:Computer science
255:
248:
247:
242:
238:Computer science
234:
227:
210:
204:
203:
195:
189:
188:
174:
105:Article policies
26:
1425:
1424:
1420:
1419:
1418:
1416:
1415:
1414:
1340:
1339:
1338:
1303:
1268:
1255:
1250:
1246:
1243:
1207:
1188:
1168:
1101:
1061:
1058:
1055:
1052:
1051:
1014:
983:
980:
975:
969:
957:Project-related
952:
933:
914:
888:
869:
850:
831:
812:
788:
755:
643:
640:
637:
634:
633:
592:
582:
551:
548:
543:
537:
525:Project-related
520:
501:
482:
456:
437:
418:
399:
380:
356:
283:
280:
277:
274:
273:
240:
208:
131:
126:
125:
124:
101:
71:
22:
21:
20:
12:
11:
5:
1423:
1421:
1413:
1412:
1407:
1402:
1397:
1392:
1387:
1382:
1377:
1372:
1367:
1362:
1357:
1352:
1342:
1341:
1307:
1302:
1299:
1298:
1297:
1267:
1264:
1242:
1239:
1206:
1203:
1187:
1184:
1167:
1164:
1100:
1097:
1094:
1093:
1090:
1089:
1086:
1085:
1078:Mid-importance
1074:
1068:
1067:
1065:
1062:C/C++ articles
1048:the discussion
1030:
1018:
1017:
1015:Mid‑importance
1009:
997:
996:
993:
992:
989:
988:
985:
984:
982:
981:
979:
978:
961:
953:
951:
950:
944:
934:
932:
931:
925:
915:
913:
912:
907:
899:
889:
887:
886:
880:
870:
868:
867:
861:
851:
849:
848:
842:
832:
830:
829:
823:
813:
811:
810:
805:
799:
789:
787:
786:
780:
768:
766:
765:
754:
753:
748:
743:
738:
732:
729:
728:
716:
715:
712:Mid-importance
702:
692:
691:
688:Mid-importance
678:
668:
667:
660:Low-importance
656:
650:
649:
647:
630:the discussion
608:
596:
595:
593:Low‑importance
577:
565:
564:
561:
560:
557:
556:
553:
552:
550:
549:
547:
546:
529:
521:
519:
518:
512:
502:
500:
499:
493:
483:
481:
480:
475:
467:
457:
455:
454:
448:
438:
436:
435:
429:
419:
417:
416:
410:
400:
398:
397:
391:
381:
379:
378:
373:
367:
357:
355:
354:
348:
336:
334:
333:
321:
320:
308:
307:
300:Mid-importance
296:
290:
289:
287:
270:the discussion
256:
244:
243:
241:Mid‑importance
235:
223:
222:
216:
205:
191:
190:
128:
127:
123:
122:
117:
112:
103:
102:
100:
99:
92:
87:
78:
72:
70:
69:
58:
49:
48:
45:
44:
38:
23:
15:
14:
13:
10:
9:
6:
4:
3:
2:
1422:
1411:
1408:
1406:
1403:
1401:
1398:
1396:
1393:
1391:
1388:
1386:
1383:
1381:
1378:
1376:
1373:
1371:
1368:
1366:
1363:
1361:
1358:
1356:
1353:
1351:
1348:
1347:
1345:
1336:
1332:
1328:
1324:
1319:
1315:
1311:
1306:
1300:
1296:
1292:
1288:
1284:
1283:
1282:
1281:
1277:
1273:
1272:Encyclopedant
1265:
1263:
1259:
1240:
1238:
1234:
1231:
1226:
1223:
1218:
1216:
1212:
1204:
1202:
1201:
1197:
1193:
1185:
1183:
1182:
1178:
1174:
1165:
1163:
1162:
1158:
1154:
1148:
1146:
1142:
1138:
1134:
1130:
1123:
1121:
1117:
1113:
1109:
1098:
1083:
1079:
1073:
1070:
1069:
1066:
1049:
1045:
1041:
1037:
1036:
1031:
1028:
1024:
1023:
1019:
1013:
1010:
1007:
1003:
974:
967:
963:
962:
960:
958:
954:
949:
946:
945:
943:
941:
940:
935:
930:
927:
926:
924:
922:
921:
916:
911:
908:
905:
901:
900:
898:
896:
895:
890:
885:
882:
881:
879:
877:
876:
871:
866:
863:
862:
860:
858:
857:
852:
847:
844:
843:
841:
839:
838:
833:
828:
825:
824:
822:
820:
819:
814:
809:
806:
804:
801:
800:
798:
796:
795:
790:
785:
782:
781:
779:
777:
776:
771:
770:
767:
763:
759:
758:
752:
749:
747:
744:
742:
739:
737:
734:
733:
731:
730:
726:
722:
721:
717:
713:
710:(assessed as
709:
708:
698:
694:
693:
689:
686:(assessed as
685:
684:
674:
670:
669:
665:
661:
655:
652:
651:
648:
631:
627:
623:
619:
615:
614:
609:
606:
602:
601:
597:
590:
586:
581:
578:
575:
571:
542:
535:
531:
530:
528:
526:
522:
517:
514:
513:
511:
509:
508:
503:
498:
495:
494:
492:
490:
489:
484:
479:
476:
473:
469:
468:
466:
464:
463:
458:
453:
450:
449:
447:
445:
444:
439:
434:
431:
430:
428:
426:
425:
420:
415:
412:
411:
409:
407:
406:
401:
396:
393:
392:
390:
388:
387:
382:
377:
374:
372:
369:
368:
366:
364:
363:
358:
353:
350:
349:
347:
345:
344:
339:
338:
335:
331:
327:
326:
323:
322:
318:
314:
313:
309:
305:
301:
295:
292:
291:
288:
271:
267:
263:
262:
257:
254:
250:
249:
245:
239:
236:
233:
229:
224:
220:
214:
206:
202:
197:
196:
187:
183:
180:
177:
173:
169:
165:
162:
159:
156:
153:
150:
147:
144:
141:
137:
134:
133:Find sources:
130:
129:
121:
120:Verifiability
118:
116:
113:
111:
108:
107:
106:
97:
93:
91:
88:
86:
82:
79:
77:
74:
73:
67:
63:
62:Learn to edit
59:
56:
51:
50:
47:
46:
42:
36:
32:
28:
27:
19:
1321:— Preceding
1304:
1269:
1260:
1244:
1235:
1229:
1227:
1221:
1219:
1214:
1208:
1189:
1173:Compynerd255
1169:
1153:Compynerd255
1149:
1127:— Preceding
1124:
1106:— Preceding
1102:
1077:
1033:
956:
955:
939:Unreferenced
937:
936:
918:
917:
892:
891:
873:
872:
854:
853:
835:
834:
816:
815:
792:
791:
773:
772:
705:
681:
659:
611:
524:
523:
507:Unreferenced
505:
504:
486:
485:
460:
459:
441:
440:
422:
421:
403:
402:
384:
383:
360:
359:
341:
340:
299:
259:
219:WikiProjects
181:
175:
167:
160:
154:
148:
142:
132:
104:
29:This is the
158:free images
41:not a forum
35:Async/await
1344:Categories
1241:Advantages
18:Talk:Async
1133:CTMacUser
827:Computing
635:Computing
622:computing
618:computers
580:Computing
395:Computing
98:if needed
81:Be polite
31:talk page
1323:unsigned
1141:contribs
1129:unsigned
1108:unsigned
1099:Untitled
875:Maintain
818:Copyedit
585:Software
443:Maintain
386:Copyedit
66:get help
39:This is
37:article.
1310:gcc doc
1256:.then()
1251:.then()
1247:.then()
1215:promise
1211:promise
1192:LeoNerd
1080:on the
856:Infobox
794:Cleanup
741:history
662:on the
589:CompSci
424:Infobox
362:Cleanup
302:on the
209:C-class
164:WPÂ refs
152:scholar
1205:Syntax
837:Expand
624:, and
405:Expand
215:scale.
136:Google
1230:async
1222:await
1053:C/C++
1012:C/C++
920:Stubs
894:Photo
751:purge
746:watch
727:with:
488:Stubs
462:Photo
319:with:
179:JSTOR
140:books
94:Seek
16:<
1331:talk
1291:talk
1276:talk
1228:The
1220:The
1196:talk
1177:talk
1157:talk
1137:talk
1116:talk
1042:and
736:edit
172:FENS
146:news
83:and
1072:Mid
1044:C++
654:Low
294:Mid
186:TWL
1346::
1333:)
1316:*
1312:*
1308:*
1293:)
1278:)
1198:)
1179:)
1159:)
1143:)
1139:•
1118:)
976:}}
970:{{
714:).
690:).
620:,
587:/
583::
544:}}
538:{{
166:)
64:;
1329:(
1289:(
1274:(
1194:(
1175:(
1155:(
1135:(
1114:(
1084:.
1040:C
959::
942::
923::
906:)
897::
878::
859::
840::
821::
797::
778::
666:.
527::
510::
491::
474:)
465::
446::
427::
408::
389::
365::
346::
306:.
221::
182:·
176:·
168:·
161:·
155:·
149:·
143:·
138:(
68:.
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.