On Mon, Nov 13, 2017 at 12:45 PM, 'Stephan Schweitzer' via golang-nuts < golang-nuts@googlegroups.com> wrote:
> > - Why are interfaces comparable by default? > > A very common comparison on interfaces is "if err == io.EOF". It also enables you, in general, to use interfaces as map keys (or, for example, what context.Context does, which is slightly different, but also relies on interface-comparisons). So, the answer is "because it enables some useful patterns". > > - Why is it not possible to mark an interface as comparable resp. not > comparable? > > In general, Go doesn't have a widely used notion of "marking a type". I assume this particular problem was considered rarely relevant to the degree that it didn't deserve its own language feature. > > - Why is it not possible do define user defined-equality? > > There is an FAQ item <https://golang.org/doc/faq#overloading> about this. > > - What is the motivation in this language design? > > I'm not sure what you are asking here. If it is about the specific choices you pointed out, they are answered above to some degree. If it is about "what principles guided Go's design" in general, this article <https://talks.golang.org/2012/splash.article> gives a good overview. -- 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.