-
-
Notifications
You must be signed in to change notification settings - Fork 4
task
Auto edited this page Sep 28, 2021
·
7 revisions
A task object holds the state of async function calls. Very similar to c# and java threads, slightly similar to javascripts broken promises.
job=go download url
job.stop
Tasks created with the go
keywords are automatically started by default.
A task is typed and from the developers perspective acts just as its type when passed as argument or when assigned:
content = go download url
content2 = go download url2
print parse content
...
what happens under the hood is that the execution of parse and print is delayed until the download finished. It is however NOT delayed by the second download.
Todo: what to do if the type contains functions or properties conflicting with the chimeric task object, such as stop
pause
etc. At the minimum a compiler warning: "please disambiguate..."