Skip to content

In your example you used closures was this just for simplicy or was there a julia specific reason #23

Answered by lbilli
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Normally data move in and out of functions via arguments and return values.
However, in an async context, callback functions (i.e. the members of Wrapper) are automatically called by code deep within the program that the user has no access to, therefore it's not possible to use the usual arguments and return values to pass data in and out.
Alternative ways are required to allow callbacks to pass data in and out.
Global variables, closures and channels are just examples of what can be used to this end.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
1 reply
@ghost
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant