3 ms·
How should users write async, futures, option, result, etc. in Scrap? My hunch is that if you do not put the syntax into the language, then it will be hard for
by substation13 3y ago
How should users write async, futures, option, result, etc. in Scrap?
My hunch is that if you do not put the syntax into the language, then it will be hard for the community to standardize on one preprocessing tool.
OCaml (which I am a fan of!) struggles with fragmentation here.
- surprisetalk 3y agoWith managed effects, all of the async stuff gets pushed over to the platform. I suspect that everybody will settle on a reusable `task` type, but each platform can determine its own async scheduling system. Consider this example: | "/home" -> q -> res:success <| "<p>howdy " ++ name ++ "</p>" , name = q |> dict/get "name" |> maybe/default "partner" | "/contact" -> _ -> res:success "<a href="mailto:hello@example.com">email</a>" | _ -> _ -> res:notfound "<p>not found</p>" . res = : success text : notfound text In this case, the platform creates a simple web server from the following type: text => query => res . res = : success text : notfound text Because scrapscript stays out of the scheduling game, the platform is free to run this code on as many cores and servers as it wants in parallel. But I 100% agree that community standardization is incredibly important! I just don't have a solution yet :) I will try my best to get everybody to work together though haha