-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Problem
Existing sync.WaitGroup
signature looks like this
def WaitGroup(count int, sig any) (sig any)
It can cover complex cases where number of tasks is unknown at compile-time, but in most cases we know that, so it's an overkill. Array-port based interface would be simpler to use:
def WaitGroup([sig] any) (sig any)
Example - Indeterministic "Hello World"
What we have
import { fmt, sync }
def Main(start any) (stop any) {
println1 fmt.Println
println2 fmt.Println
wg sync.WaitGroup
---
:start -> [
'Hello' -> println1,
', World!' -> println2
]
[println1, println2] -> wg:sig
2 -> wg:count
wg -> :stop
}
What we need
import { fmt, sync }
def Main(start any) (stop any) {
println1 fmt.Println
println2 fmt.Println
wg sync.WaitGroup
---
:start -> [
'Hello' -> println1 -> wg[0],
', World!' -> println2 -> wg[1]
]
wg -> :stop
}
Solution
- Rename existing
sync.WaitGroup
to something else (figure out good naming) - Change
sync.WaitGroup
interface to array-port based - Update related examples and/or e2e tests and docs (if needed)
Related to #864
Metadata
Metadata
Assignees
Labels
No labels