Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > Java基础相关 >

The Go Programming Language PDF 下载


分享到:
时间:2021-10-01 08:00来源:http://www.java1234.com 作者:转载  侵权举报
The Go Programming Language PDF 下载
失效链接处理
The Go Programming Language  PDF 下载


本站整理下载:
提取码:qkbm 
 
 
相关截图:
 
主要内容:

The Origins of Go
Like biolog ical species, successf ul langu ages beget offspring that incor porate the advantages of
their ancestors; int erbre e ding som etimes leads to sur prising strengt hs; and, ver y occasionally,
a radic al ne w fe ature arises wit hout pre cedent. We can lear n a lot about why a langu age is the
way it is and what env iro nment it has been adapt ed for by looking at these influences.
The figure below shows the most imp ortant influences of earlier programming langu ages on
the desig n of Go.
Go is som etimes des crib ed as a ‘‘C-li ke langu age,’’ or as ‘‘C for the 21st century.’’ Fr om C, Go
in her ite d its expression syntax, cont rol-flow statements, basic dat a types, cal l-by-value param￾eter passing, point ers, and above all, C’s emp hasis on programs that compi le to efficient
machine code and cooperate natural ly wit h the abstrac tions of cur rent operat ing systems.
The Go Programming Language
© 2016 Alan A. A. Donovan & Brian W. Kernighan
revision 3b600c, date 29 Sep 2015
ptg16091132
THE ORIGINS OF GO xiii
But there are other ancestors in Go’s fami ly tre e. One maj or stream of influence comes fro m
languages by Nik laus Wir th, beg inning wit h Pascal. Modula-2 inspired the package con cept.
Ob ero n eliminated the distinc tion bet ween module int erface files and module imp lementation
files. Obero n-2 influence d the syntax for packages, imports, and declarat ions, and Obj e ct
Ob ero n prov ide d the syntax for met hod declarat ions.
Anot her lineage among Go’s ancestors, and one that makes Go distinc tive among recent
prog ramming langu ages, isa sequence of lit tle-k now n research langu ages deve lop ed at Bel l
Labs, all ins pired by the con cept of commu nicating sequent ial pro cesses (CSP) fro m To ny
Ho are’s seminal 1978 pap er on the found ation s of con cur rency. In CSP,aprogram isaparal lel
comp osition of processes that have no share d st ate; the pro cesses communic ate and synchro￾nize using channel s. But Hoare’s CSP was a for mal langu age for des cribing the fundament al
concepts of con cur rency, not a programming langu age for writing exe cut able programs.
Rob Pike and others began to exp eriment wit h CSP imp lementation s as actu al langu ages. The
firs t was cal le d Sque ak (‘‘A langu age for communic ating wit h mice’’), which provide d a lan￾gu age for handling mou se and key board events, wit h st atically cre ate d ch annel s. This was
fo llowe d by Newsque ak, which offered C-li ke statement and expression syntax and Pas cal-li ke
type not ation. It was a purely functional langu age wit h garb age col lec tion, again aimed at
managing key board , mous e, and window events. Channel s became firs t-class values, dynami￾cally cre ate d and storable in variables.
The Plan9operat ing system car r ied these ide as forward in a langu age cal le d Alef. Alef tried
to make Newsque ak a viable system programming langu age, but its omission of garb age col￾le ction made conc urrency too painf ul.
Ot her cons tructions in Go show the influence of non-ancestral genes here and there; for
example iota is loosely fro m APL, and lexic al scop e with neste d func tions is fro m Scheme
(and most langu ages since). Here too we find nove l mu tat ions. Go’s innovat ive slices provide
dy namic arrays wit h efficient random access but als o permit sop histicate d sh aring
ar rangements reminiscent of lin ked lists. And the defer st atement is new wit h Go.
The Go Project
Al l prog ramming langu ages reflec t the programming phi losop hy of their creators, which often
includes a significant component of reaction to the perceive d shortcomings of earlier lan￾gu ages. The Go pro jec t was bor ne of frust rat ion wit h several sof tware systems at Google that
were suf fer ing fro m an explosion of complexity. (This pro blem is by no means unique to
Go ogle.)
As Rob Pike put it, ‘‘comp lexity is multiplic ative’’: fixingapro blem by mak ing one par t of the
system more complex slowly but surely adds complexity to other par ts. Wi th con stant pres￾sure to add features and opt ion s and configurat ions, and to ship code quickly, it’s easy to
neglec t simplicity, even thoug h in the lon g run simplicity is the key to good sof tware.
The Go Programming Language
© 2016 Alan A. A. Donovan & Brian W. Kernighan
revision 3b600c, date 29 Sep 2015
ptg16091132
xiv PREFACE
Simp licity requires more wor k at the beg inning ofapro jec t to reduce an idea to its essence and
more dis cip line over the lifet ime of a pro jec t to distinguish good changes fro m bad or per nicious ones. Wit h sufficient effor t,agood change can be accommodated wit hout compromising what Fre d Brooks cal le d the ‘‘conceptu al int egr ity’’ of the desig n butabad change cannot,
andaper nicious change trades simplicity for its shallow cou sin, conv enience. Only through
simplicity of desig n canasystem remain stable, sec ure , and coh erent as it grows.
The Go pro jec t includes the langu age its elf, its tools and stand ard librar ies, and last but not
le ast, a cultural agenda of radic al simplicity. Asarecent hig h-leve l language , Go has the bene-
fit of hindsig ht, and the basics are don e we ll: it has garbage col lec tion,apackage system, firs tcl ass functions, lexic al scop e,asystem cal l interface, and immut able str ings in which text is
general ly encoded in UTF-8. But it has comp arat ive ly few features and is unlikely to add
more . Fo r inst ance, it has no imp licit numer ic conv ersions, no con str uctor s or destr uctor s, no
op erator overloading, no defau lt parameter values, no inher itance, no gener ics, no exception s,
no macros, no function annot ation s, and no thread-lo cal storage. The langu age is mature and
st able, and guarante es backwards compatibi lit y: older Go programs can be compi led and run
with newer versions of compi lers and stand ard librar ies.
Go has enough ofatyp e system to avoid most of the careless mistakes that plague programmers in dynamic langu ages, but it has a simpler typ e system than comparable typ ed langu ages.
This appro ach can som etimes lead to isolate d pockets of ‘‘untyped’’ prog ramming wit hin a
broader framewor k of typ es, and Go programmers do not go to the lengt hs that C++ or
Haskel l prog rammers do to express safet y prop erties as typ e-bas ed pro ofs. But in prac tice Go
gives programmers much of the safet y and run-t ime per for mance benefits ofarel ative ly
st ron g type system wit hout the burden ofacomplex one.
Go encourages an awareness of contemp orar y comp uter system desig n, partic ularly the
importance of locality. Its bui lt-in dat a types and most librar y data str uctures are craf ted to
work natural ly wit hout explicit initializat ion or imp licit con str uctor s, so rel ative ly few memor y al location s and memor y wr ites are hidden in the code. Go’s aggregate typ es (str ucts and
ar rays) hold their elements direc tly, requir ing less storage and fewer allo cat ions and point er
indirec tion s than langu ages that use indirec t fields. And since the moder n comp uter isaparal lel machine, Go has conc urrency features bas ed on CSP, as mention ed earlier. The var iablesize stacks of Go’s lig htweig ht threads or goro utines are initial ly small enoug h that creating one
goro utine is che ap and cre ating a million is prac tic al.
Go’s stand ard librar y, often descr ibed as coming wit h ‘‘batt eries include d,’’ prov ides cle an
building blo cks and APIs for I/O, text pro cessing, graphics, cryptography, net wor king, and
dist ribut ed app lic ations, wit h supp ort for many stand ard file for mats and pro tocol s. The
librar ies and tools make extensive use of convent ion to reduce the need for configurat ion and
explanation, thu s simplif ying program logic and mak ing diverse Go programs more simi lar to
each other and thu s easier to learn. Pro jec ts bui lt using the go to ol use only file and identifier
names and an occ asional speci al comment to deter mine all the librar ies, exec utables, tests,
benchmarks, examples, platfor m-specific var iants, and documentation for a proj e ct; the Go
source its elf cont ains the bui ld sp ecification.

 

------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐