The good news is that Go is simpler than many other languages, with fewer 
constructs, concepts and corner cases. So after using it for a while, you 
will rarely bump into anything "new". 
Reading the language spec is great, and I have done it myself a couple of 
times. But, depending on your level of programming experience, it may be a 
bit difficult to pull useful information from the spec, and can be a bit 
tedious to read. For starters, I strongly suggest working through A Tour of 
Go <https://tour.golang.org/welcome/1>, maybe a few times. It covers almost 
all the language concepts. Type switches are covered in in the tour at: 
https://tour.golang.org/methods/16.

On Wednesday, July 29, 2020 at 5:21:23 PM UTC-4 shan...@gmail.com wrote:

>
>
> On Wednesday, July 29, 2020 at 7:23:22 PM UTC+10, mb0 wrote:
>>
>> This is a special kind of switch called a type switch. You can read more 
>> about it in the language specification where its part of the intrinsic 
>> go syntax. https://golang.org/ref/spec#Switch_statements 
>>
>> Because it is a special language construct you need to look at the 
>> compiler. You probably want to check out the default gc compiler and may 
>> start your journey here: 
>>
>> https://github.com/golang/go/blob/master/src/cmd/compile/internal/gc/swt.go#L617
>>  
>>
>> This is really helpful, thanks.
>
> The two questions I am left with are:
> How do I recognise that something is a "special language construct"; is it 
> simply a matter of, I cannot ctrl-] to it directly, so I need to grep?
>
>
> And, just as importantly, how do I find out what I need to grep /for/
>
> Regards
>  
>

-- 
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/81b3fbee-9628-4571-9816-c1df299671ebn%40googlegroups.com.

Reply via email to