资源描述:
《p. javagi generalized interfaces for java》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、JavaGI:GeneralizedInterfacesforJavaStefanWehr1,RalfL¨ammel2,andPeterThiemann11Institutf¨urInformatik,Universit¨atFreiburg{wehr,thiemann}@informatik.uni-freiburg.de2MicrosoftCorp.,Redmondralf.lammel@microsoft.comAbstractJavaGIisanexperimentallanguagethatextendsJava1.5bygeneralizingtheinterfaceconc
2、epttoincorporatetheessentialfeaturesofHaskell’stypeclasses.Inparticular,generalizedinterfacescaterforretroactiveandconstrainedinterfaceimplementations,binarymethods,staticmethodsininterfaces,defaultimplementationsforinterfacemeth-ods,interfacesoverfamiliesoftypes,andexistentialquantificationforint
3、erface-boundedtypes.Asaresult,manyanticipatoryusesofdesignpatternssuchasAdapter,Factory,andVisitorbecomeobsolete;severalextensionandintegrationproblemscanbesolvedmoreeasily.JavaGI’sinterfacecapabilitiesinteractwithsubtyping(andsubclassing)ininter-estingwaysthatgobeyondtypeclasses.JavaGIcanbetrans
4、latedtoJava1.5.ItsformaltypesystemisderivedfromFeatherweightGJ.1IntroductionWhatarethedistinguishingcharacteristicsofHaskellcomparedtootherpro-gramminglanguages?Aninformedanswerwilleventuallymentiontypeclasses.Typeclasseshavebeeninventedfordealingwithoverloadinginfunctionalprogramminglanguagesina
5、non–ad-hocmanner[20,37].Tothesurpriseoftheirinventors,typeclassesprovidepowerfulmeansforsolvingvarioussoftware-designproblems.Forinstance,sufficientlypowerfultypeclassesystemsaddressvarioussoftwareextensionandintegrationproblems[23]—infact,arangeofproblemsforwhichpreviouslyawholearrayoftechniquesan
6、dprogramminglanguageextensionshasbeenproposed.TheobservationthattypeclassesandJava-styleinterfacesarerelatedisnotnew[32,23].Inthiscontext,thefollowingquestionsarise:(i)Whatpartoftype-classexpressivenesscorrespondstointerfaces?(ii)Whatistheexactvalueofadditionaltype-classexpressivenessforanOOlangu
7、age?(iii)WhatisaviableOOlanguagedesignwithinterfacesthatcovermostifnotalltype-classexpressiveness?ThepaperanswersthesequestionsbyproposingthedesignofJavaGI(JavawithGeneralizedInterfaces)asalanguageextensionofJava1.5.Ty