News for hackers. Stuff that matters.
Re:The Acton Programming Language by sigmonsays on Thursday December 05, 2024 @06:55PM (#42334271)
This is weird to me: "A method is called asynchronously when the return value is not used."

Which means the behavior changes when there is no return value?

Re:The Acton Programming Language by pepa65 on Friday December 06, 2024 @01:28AM (#42336978)
Return value is not needed, so just "call away" -- asynchronously.

I guess this means when a return value is used, the call is synchronous, and after running the method processing resumes where things left off.

Re:The Acton Programming Language by kll on Monday December 09, 2024 @11:48AM (#42367826)
Yes indeed, assigning really turns into an await on an async value. You can explicitly write it as

    a = await async remote_actor.foobar()
So the local actor goes to sleep, awaiting the remote, then the RTS notices the returned value and place the actor on the readyQ for execution, thus waking up from the await.
Re:The Acton Programming Language by kll on Monday December 09, 2024 @11:04AM (#42367443)
Yes, it does affect the local control flow. If you don't assign the return value, then the local actor will proceed execution of the next thing, so effectively async execution of the remote method call. You can also write this explicitly like so:

    async remote_actor.foobar()
If you on the other hand want to wait for that remote actor to finish but still not assign locally you can use a dummy variable:

    _ = remote_actor.foobar()
or explicitly ask to await

    await async remote_actor.foobar()
You can also explicitly ask for async while grabbing the return value, which makes it easy to run things concurrently

    a1 = async remote_actor1.foobar()
    a2 = async remote_actor2.foobar()
    print("a1 and a2 run concurrently")
    r1 = await a1 # collect both results
    r2 = await a2
    print(r1, r2)