I've been thinking of what would be a good syntax for coroutines. I like the design of Erlang, Go and Pony. But I would like a syntax that provides very good control over coroutine hierarchies. Here's some syntax I'm playing with:
I like the idea of Go's channels, for yielding, what if you want to yield to different places? So I'm trying to incorporate that idea.
This example creates 10 producers that talk to 1 consumer:
producers = []
task Producer():
while running:
output.yield(1)
task Consumer():
while running:
value = input.read()
print(value)
for index in range(0, 10):
producers = Producer()
producers.append(producer)
producer.output -> consumer.input
consumer = Consumer()
This example takes 1 producer and wires them to 10 consumers:
multiple_consumers = []
one_producer = Producer()
for item in range(0, 10):
consumer = Consumer()
multiple_consumers.append(consumer)
one_producer.output -> multiple_consumers
I've been thinking of using the -> operator to wire up channels of coroutines. You can even wire up to a collection of coroutines.
I want to handle 1:1, 1:* and *:1 and *:* and load balancing. How do you suggest I create these hierarchies syntactically?
I am unsatisfied with coroutines in C, I ported some assembly from a blog post (down atm) to run coroutines in GNU Assembler syntax
https://github.com/samsquire/assembly/blob/main/coroutines.S https://blog.dziban.net/coroutines/ ( down)
I've been thinking of what would be a good syntax for coroutines. I like the design of Erlang, Go and Pony. But I would like a syntax that provides very good control over coroutine hierarchies. Here's some syntax I'm playing with:
I like the idea of Go's channels, for yielding, what if you want to yield to different places? So I'm trying to incorporate that idea.
This example creates 10 producers that talk to 1 consumer:
This example takes 1 producer and wires them to 10 consumers: I've been thinking of using the -> operator to wire up channels of coroutines. You can even wire up to a collection of coroutines.I want to handle 1:1, 1:* and *:1 and *:* and load balancing. How do you suggest I create these hierarchies syntactically?