Hi, the CoalesceOrEmpty function is awesome, but it doesn't work for slices. Can we add a counterpart for CoalesceOrEmpty that works for nil/empty slices?
We could call it CoalesceOrEmptySlice and define it with standard generic types like the existing Coalesce:
func CoalesceOrEmptySlice[T ~[]E, E any](v ...T) (result T, ok bool) {
(Alternatively we could try removing the comparable limitation on the existing Coalesce, but I haven't tested whether that would work for nil slices)
Hi, the CoalesceOrEmpty function is awesome, but it doesn't work for slices. Can we add a counterpart for
CoalesceOrEmpty
that works for nil/empty slices?We could call it
CoalesceOrEmptySlice
and define it with standard generic types like the existing Coalesce:(Alternatively we could try removing the comparable limitation on the existing Coalesce, but I haven't tested whether that would work for nil slices)