On Wed, 28 Sep 2016 23:07:06 -0600 andrey mirtchovski <mirtchov...@gmail.com> wrote:
> > I just want to understand what is the deep reason for the syntax > > inconsistency between map index and type assert. > > a map is fully typed at compile time. even if its key is of type > interface{} the language defines how to compare two interface{} values > using type assertion here: > https://golang.org/ref/spec#Comparison_operators > > "Interface values are comparable. Two interface values are equal if > they have identical dynamic types and equal dynamic values or if both > have value nil." > > Using interface{} in assignments on the other hand is only type-safe > at runtime when used with a type assertion. Kudos for IMO the best explanation of these matters posted to this thread ;-) -- 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.