资源描述:
《The Scala Language Tour .pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、ScalaLanguageTourTuesday,October4,20111Tuesday,October4,20112Tuesday,October4,20112CraigTataryn@craigerTuesday,October4,20113CraigTataryn•TheBasementCodersPodcast•-basementcoders.com@craigerTuesday,October4,20113CraigTataryn•TheBasementCodersPodcast•-basementcod
2、ers.com@craiger•WinnipegFunctionalProgrammingGroup•WfPG-wfpg.caTuesday,October4,20113CraigTataryn•TheBasementCodersPodcast•-basementcoders.com@craiger•WinnipegFunctionalProgrammingGroup•WfPG-wfpg.ca•!•grindsoftware.comTuesday,October4,20113WhatisScala?Tuesday,October4,20114WhatisScala?•Combines
3、Functional&ObjectOrientedTuesday,October4,20114WhatisScala?•CombinesFunctional&ObjectOriented•InteropwithJavaTuesday,October4,20114WhatisScala?•CombinesFunctional&ObjectOriented•InteropwithJava•Dynamic-likeSyntaxinaStaticLanguageTuesday,October4,20114WhatisScala?•CombinesFunctional&ObjectOrient
4、ed•InteropwithJava•Dynamic-likeSyntaxinaStaticLanguage•Easytostartplayingwith(REPL)Tuesday,October4,20114Let’sStartVariables&ClassesTuesday,October4,20115Tuesday,October4,20116Tuesday,October4,20116DeclaringaClasspublicclassPerson{publicStringname;publicPerson(S
5、tringname){this.name=name;}publicStringgetName(){classPerson(varname:String)returnthis.name;}publicvoidsetName(Stringname){this.name=name;}}*Tuesday,October4,20117FunctionDefinitionsdefsavePerson(p:Person):ID={dao.save(p)}Tuesday,October4,20118FunctionDefinitionsStartofFunctionDeclarationdefsaveP
6、erson(p:Person):ID={dao.save(p)}Tuesday,October4,20118FunctionDefinitionsStartofFunctionFunctionNameDeclarationdefsavePerson(p:Person):ID={dao.save(p)}Tuesday,October4,20118FunctionDefinitionsStartofFunctionParameterFunctionNameNameDeclarationdefsavePerson(p:Person):ID={dao.save(p)}Tuesday,Octobe
7、r4,20118FunctionDefinitionsStartofFunctionParameterParameterFunctionNameNameTypeDeclarationdefsavePerson(p:Person):ID={dao.save(p)}Tuesday,October4,20118FunctionDefinitionsStartofFunctionFunctionParameterParameterFunctionReturnNameN