On Mon, Aug 10, 2020 at 9:46 AM 'Richard Oudkerk' via golang-nuts <golang-nuts@googlegroups.com> wrote: > Another way to bridge the gap between builtin and custom types could be to > have a package op that has functions that delegate to either an operator or a > method. Then you could write generic functions like > > func Min[type T op.Lessable](a, b T) T { > if op.Less(a, b) { > return b > } > return a > } ...
Indeed, and quite a while ago I sketched out a proposal along those lines: https://gist.github.com/pat42smith/ed63aca983d4ba14fdfa320296211f40 . There was very little reaction to that proposal. > I don't think op.Lessable is expressible with the latest proposal though. Also true, so this almost certainly won't fly. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAADvV_v2KDgy-YwijSoCCsyMH7D4TDALvenP59G4MdvLhWTQnA%40mail.gmail.com.