资源描述:
《understanding_nil__1_英文文献资料》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、understandingnil@francescthankswelcomeeverysingleoneofyouagendawhatisnil?whatisnilinGo?whatdoesnilmean?isniluseful?nil?youmisspellednullhowIlearnwordshowIlearnwordsetymologynilLatinnihilmeaningnothingnullLatinne+ullusmeaningnotanynoneOldEnglishne+ānmeaningnotonenamesforthenumberzer
2、oinEnglish-zero-cipher-null-love-duck-nil-nada-zilch-zip-theletter‘o’-naught-nought-aught-oughtsource:wikipedianilis(a)zerointerludeabitofhistory“Icallitmybillion-dollarmistake.Itwastheinventionofthenullreferencein1965.Atthattime,Iwasdesigningthefirstcomprehensivetypesystemforrefer
3、encesinanobjectorientedlanguage.”-SirC.A.R.Hoarepanic:runtimeerror:invalidmemoryaddressornilpointerdereferenceUncaughtTypeError:undefinedisnotafunctionnilleadstopanicpanicleadstofearbydanpawleyonFlickrfearleadstobykorymatthewonFlickrλfunctionalprogramming“FunctionalGo?Thanks,butno”
4、-francescatdotGo.eu2015therearemanyways,nilistheGowayzerovalueswhatarethey?zerovaluesbool→falsepointers→nilnumbers→0slices→nilstring→""maps→nilchannels→nilfunctions→nilinterfaces→nilzerovaluesforstructtypestypePersonstruct{AgeYearsintNamestringFriend[]Person}varpPerson/
5、/Person{0,"",nil}thetypeofnil“...unlessthevalueisthepredeclaredidentifiernil,whichhasnotype”-Golanguagespecificationuntypedzeroa:=falsea:=""a:=0//a:=int(0)a:=0.0//a:=float64(0)a:=nil//useofuntypednil“nilisapredeclaredidentifierrepresentingthezerovalueforapointer,channel,func,interf
6、ace,map,orslicetype.”-Godocumentationfor“builtin”package“nilisapredeclaredidentifierrepresentingthezerovalueforapointer,channel,func,interface,map,orslicetype.”-Godocumentationfor“builtin”packagetwenty-five*keywordsbreakdefaultfuncinterfaceselectcasedefergomapstructchanelsegotopack
7、ageswitchconstfallthroughifrangetypecontinueforimportreturnvar*plusthefivesecretones,obviouslypredefinedvskeyword//YOLOvarnil=errors.New(“¯_(ツ)_/¯”)*Forextraevilness:placeattheendofdoc.gozerovalueswhatdotheymean?kindsofnilpointersslicesmapschannelsfunctionsinterfaceskindsofnilpoin
8、tersslicesmapschannelsfunc