Change with the situation, move with the times, Go lang1.18 introductory refining tutorial, from Bai Ding to Hongru, the use of Go lang generics EP15

Original link:

In fact, generics are the most distinctive feature of Golang 1.18, but why do we have to delay to discuss generics? By analogy, we can imagine telling the first graders of primary school Wang Bo’s famous essay “Preface to the Pavilion of King Teng”. How likely are the primary school students to understand the author’s ambitions and the anger that is hard to achieve? I’m afraid it’s hard, yes, if you don’t have a period of experience with Golang’s strongly typed syntax, it’s hard to understand the “anti” static language concept of generics. Basic Concepts What is Generics? Generics Generics, as the name suggests, generic types, to put it bluntly, are the characteristics of using dynamically typed languages ​​in a statically typed locale: packagemainimport(“fmt”)funcsum(astring,bstring)string{s:=a+breturns…

This article is reprinted from:
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment