DEV Community

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

Collapse
tsnobip profile image
Paul Tsnobiladzé

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

Collapse
praveenkumarrr profile image
Praveen Author • Edited on

You can think of it like an assignment statement.
let a = await fetchAuthorById(1) // Js
~a=fetchAuthorById(1)
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.