Quoting Eric S. Raymond (2018-10-19 16:15:25)
> Ian Denhardt <i...@zenhack.net>:
> > What would code making use of a `Sortable` type look like? If you can't
> > actually use "implements <" to overload `<`, it's not clear to me what
> > it would actually do?
>
> Be available to a Sort function.  That is, the requirement "Have a Less()"
> would be replaced by "Have an implements-< method".
>
> How this is specified at the callsite is a separate question.  I can't
> see any simpler way to do it than writing '<', but if anyone hates
> overloading enough to invent a syntax they can do it ab nd
> I won't complain.
>
> I'm saying I'd prefer that future to heavyweight contracts.  Surface
> overloading is *not* the important thing about "implements"; having a
> lightweight way to refer to typeclasses like "Sortable" is.

Ah, so are you just suggesting you'd be able to do (e.g.):

func SortSlice(type T implements <)(slice []T) {
    // ...
}

..but not actually be able to redefine `<` for a user-defined type?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to