DEV Community

Discussion on: Async await like syntax, without ppx in Rescript !!!

tsnobip profile image
Paul Tsnobiladzé

why using labeled functions here? Since order has a meaning here, why not just use unlabeled arguments?

praveenkumarrr profile image
Praveen Author • Edited on

You can think of it like an assignment statement.
let a = await fetchAuthorById(1) // Js
More importantly, the labels are used as keys in the object that is being passed into the next function. Next function can access previous result with arg["a"]. It helps to remind at which key the result is stored.