You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was thinking about how one could gather the results of an actor, and keeping in sync with the flow of the caller. Create a behaviour for this purpose would be possible put would not allow the sync part.
I believe this should be useful for several conception at least for queue and future
So I came with the following new syntax. (To be bikeshedding on exact syntax
or keyword)
actor Future
new create() =>
None
be compute() =>
env.out.print("a possible long processing which can be interrupted")
let result = 1+2
#on_call execution point
on_call result():int =>
return result
actor Queue
new create() =>
None
be enqueue(item:int) =>
on_call dequeue():int =>
return item
actor Main
new create(env:Env) =>
let f = Future.create()
f.compute()
#on_call calling point
env.out.print(f.result())
let q = Queue.create()
q.enqueue(1)
q.enqueue(2)
q.enqueue(3)
env.out.print(q.dequeue()) #1
env.out.print(q.dequeue()) #2
env.out.print(q.dequeue()) #3
How it would work? with one new actor output queue,
When a behaviour or a function reach the sync on_call calling point
it put the return value of the on_call function in the output queue.
When an on_call calling point is reached: if there is nothing in the output queue, it wait up to the point the queue is filled. If there is something in the output queue, it return the first item of the output queue as the result of the on_call call
To sum up it is the symmetric operation of a behaviour of an actor, but instead of sending a message from an actor, it receiving a message from an Actor.
PS: I use to be unclear in my wording, so don't hesitate to ask for clarification.
The text was updated successfully, but these errors were encountered:
I was thinking about how one could gather the results of an actor, and keeping in sync with the flow of the caller. Create a behaviour for this purpose would be possible put would not allow the sync part.
I believe this should be useful for several conception at least for queue and future
So I came with the following new syntax. (To be bikeshedding on exact syntax
or keyword)
How it would work? with one new actor output queue,
When a behaviour or a function reach the sync on_call calling point
it put the return value of the on_call function in the output queue.
When an on_call calling point is reached: if there is nothing in the output queue, it wait up to the point the queue is filled. If there is something in the output queue, it return the first item of the output queue as the result of the on_call call
To sum up it is the symmetric operation of a behaviour of an actor, but instead of sending a message from an actor, it receiving a message from an Actor.
PS: I use to be unclear in my wording, so don't hesitate to ask for clarification.
The text was updated successfully, but these errors were encountered: