On Thursday, September 29, 2016 at 1:31:41 PM UTC+8, Ian Lance Taylor wrote: > > On Wed, Sep 28, 2016 at 10:02 PM, T L <tapi...@gmail.com <javascript:>> > wrote: > > > > On Thursday, September 29, 2016 at 12:56:57 PM UTC+8, Micky wrote: > >> > >> The reason is directly stated in the Go language spec: > >> > >> "If the type assertion holds, the value of the expression is the value > >> stored in x and its type is T. If the type assertion is false, a > run-time > >> panic occurs." > >> > >> Here "hold" means if it succeeds. > >> > > > > I know of the syntax in spec. > > I just want to understand what is the deep reason for the syntax > > inconsistency between map index and type assert. > > Why do you think there is an inconsistency? > > Let me put it another way. A type assertion and a map index are two > different kinds of expressions. They do different things. What kind > of consistency do you expect between them? > > Ian >
I just feel that It is weird that the behavior of type assertion depends on whether the second OK result variable is provided or not. -- 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.