if we could have a list of use case,
written in g1, with an explanation about why it can t be generalized,
we could check any proposal that at first it answers them,
then enter into more detailed study and proposals ?
I m reluctant to provide examples about concurrency,
i have some ideas of what functions i need,
i m not hot to write them...
At least here is some func i wish was generalized
- concurrentSync(sync func(...)..., concurrency int) (wrappedSync func(...)...., cancel chan struct{})
- concurrentAsync(async func(..., jobDoneSignal chan struct{})..., concurrency int) (wrappedSync func(..., jobDoneSignal chan struct{})..., cancel chan struct{})
(this sig is soooo long...)
- throttle (call a func at most once every D time.Duration)
throttle(f func(...)..., d time.Duration, head bool) (throttledFunc func(...)..., cancel chan struct{})
- mustNorErr ?
then stuff like map.Each, slice.Each etc.
That being said, in
func Add1(key $A, val $B, m map[$A]$B) {
m[$A] = $B
return
}It will trigger a runtime error if $A is of type []byte (met that error yesterday with an interface{} type).
Sooooo, as the bloat already exists with interface{}, is it something to keep or to remove ?
More generally at which extent runtime 42 errors are acceptable,
or should be used to compromise a prefect/ideal model in order to simplify/fix <something in the model> ?