Under consideration for publication in J. Functional Programming1AnExt的中文翻譯

Under consideration for publication


Under consideration for publication in J. Functional Programming
1
AnExtendedComparativeStudy of Language
Supportfor Generic Programming
¨
RONALDGARCIA1,JAAKKOJARVI2,ANDREWLUMSDAINE1
JEREMYSIEK3,JEREMIAHWILLCOCK1
1 Open Systems Lab, Indiana University, Bloomington, IN USA
2 Texas A&M University, Computer Science, College Station, TX USA
3 Rice University, Computer Science, Houston, TX USA
(e-mail: {garcia,lums,jewillco}@osl.iu.edu, jeremy.g.siek@rice.edu, jarvi@cs.tamu.edu)
Abstract
Many modern programming languages support basic generics, sufficient to implement
type-safepolymorphiccontainers.Somelanguageshavemovedbeyondthisbasicsupport,
andindoingsohaveenabledabroader,morepowerfulformofgenericprogramming.This
paperreportsonacomprehensivecomparisonoffacilitiesforgenericprogrammingineight
programming languages: C , Standard ML, Objective Caml, Haskell, Eiffel, Java, C#
++
(withitsproposedgenericsextension),andCecil.Byimplementingasubstantialexample
in each of these languages, we illustrate how the basic roles of generic programming can
be representedineachlanguage.Wealsoidentifyeightlanguageproperties thatsupport
thisbroaderviewofgenericprogramming:supportformulti-typeconcepts,multiplecon-
straintsontypeparameters,convenientassociated typeaccess,constraintsonassociated
types, retroactive modeling, type aliases, separate compilation of algorithms and data
structures, and implicit argument type deduction for generic algorithms. We find that
thesefeaturesarenecessarytoavoidawkwarddesigns,poormaintainability,andpainfully
verbose code. As languages increasingly support generics, it is important that language
designersunderstandthefeaturesnecessarytoenabletheeffectiveuseofgenericsandthat
theirabsencecancausedifficultiesforprogrammers.
Contents
1 Introduction
2 Generic Programming
2
4
3 A Generic Graph Library
8
4 Graph Library in C++
13
14
17
17
18
21
24
27
29
4.1
4.2
Implementation
EvaluationofC++
5 Graph Library in Standard ML
5.1
5.2
Implementation
EvaluationofStandardML
6 Graph Library in OCaml
6.1
6.2
Implementation
EvaluationofOCaml




2
Garciaetal.
7 Graph Library in Haskell
31
31
33
34
35
36
40
40
42
43
43
45
46
46
49
49
50
52
52
54
56
57
58
60
7.1
7.2
Implementation
EvaluationofHaskell
8 Graph Library in Eiffel
8.1
8.2
Implementation
EvaluationofEiffel
9 Graph Library in Java
9.1
9.2
Implementation
EvaluationofJava
10Graph Library in C# generics
10.1 Implementation
10.2 EvaluationofC#generics
11Graph Library in Cecil
11.1 Implementation
11.2 EvaluationofCecil
12Discussion
12.1 EncapsulatingTypeConstraintsinConcepts
12.2 AccesstoAssociatedTypes
12.3 ImplicitInstantiation
12.4 EstablishingtheModelingRelation
12.5 TypeAliases
12.6 ConciseSyntax
13Conclusion: Beyondfold andList
References
1 Introduction
Genericsareanincreasinglypopularandimportanttool forsoftwaredevelopment
and many modern programming languages provide basic support for them. For
example,theuseoftype-safepolymorphiccontainersisroutineprogrammingprac-
tice today. Some languages have moved beyond elementary generics to support-
ing a broader, more powerful form of generic programming, enabling the devel-
opment of highly reusable algorithms. Such extensive support for generics has
proven valuable in practice. Generic programming has been a particularly effec-
tivemeansforconstructingreusablelibrariesofsoftwarecomponents,oneexample
ofwhichistheStandardTemplateLibrary(STL),nowpartoftheC++
Standard
Library(Stepanov&Lee,1994;ISO1998).Asthegenericprogrammingparadigm
gainsmomentum,theneedforaclearanddeepunderstandingofthelanguageis-
suesincreases.Inparticular,itisimportanttounderstandwhatlanguagefeatures
arerequiredtosupportthisbroadernotionofgenericprogramming.
To aid in this process, we present results of a study comparing eight program-
ming languages that support generics: Standard ML (Milner et al., 1997), Objec-
tive Caml (Leroy, 2000), C++ (ISO, 1998), Haskell (Peyton Jones et al. , 1999),




LanguageSupportforGenericProgramming
3
Eiffel(Meyer,1992),Java(Goslingetal.,2005),C#(Kennedy&Syme,2001;Mi-
crosoft Corporation, 2002), and Cecil (Litvinov, 1998). Seven of these languages
currentlysupportgenerics,andtheyhavebeenimplementedandproposedforthe
nextrevisionofC#.Theselanguageswereselectedbecausetheyarewidelyusedor
representthestateoftheartinprogramminglanguageswithgenerics.Thispaperis
arevisedandextendedversionof(Garciaetal.,2003),featuringupdatedanalyses
andtheadditionoftwolanguages,ObjectiveCamlandCecil.
Ourgoalsforthisstudywerethefollowing:
• Tounderstandwhichlanguagefeaturesarenecessarytosupportgenericpro-
gramming;
• To understand the extent to which specific languages support generic pro-
gramming;
• Toprovideguidancefordevelopmentoflanguagesupportforgenerics;and
• Toilluminateforthecommunitysomeofthepowerandsubtletiesofgeneric
programming.
Itisdecidedlynotagoalofthispapertodemonstratethatanyonelanguageis“bet-
ter”thananyother.Thispaperisalsonotacomparisonofgenericprogrammingto
anyotherprogrammingparadigm,beitobject-oriented,f
0/5000
原始語言: -
目標語言: -
結果 (中文) 1: [復制]
復制成功!
Under consideration for publication in J. Functional Programming1AnExtendedComparativeStudy of LanguageSupportfor Generic Programming¨RONALDGARCIA1,JAAKKOJARVI2,ANDREWLUMSDAINE1JEREMYSIEK3,JEREMIAHWILLCOCK11 Open Systems Lab, Indiana University, Bloomington, IN USA2 Texas A&M University, Computer Science, College Station, TX USA3 Rice University, Computer Science, Houston, TX USA(e-mail: {garcia,lums,jewillco}@osl.iu.edu, jeremy.g.siek@rice.edu, jarvi@cs.tamu.edu)AbstractMany modern programming languages support basic generics, sufficient to implementtype-safepolymorphiccontainers.Somelanguageshavemovedbeyondthisbasicsupport,andindoingsohaveenabledabroader,morepowerfulformofgenericprogramming.Thispaperreportsonacomprehensivecomparisonoffacilitiesforgenericprogrammingineightprogramming languages: C , Standard ML, Objective Caml, Haskell, Eiffel, Java, C#++(withitsproposedgenericsextension),andCecil.Byimplementingasubstantialexamplein each of these languages, we illustrate how the basic roles of generic programming canbe representedineachlanguage.Wealsoidentifyeightlanguageproperties thatsupportthisbroaderviewofgenericprogramming:supportformulti-typeconcepts,multiplecon-straintsontypeparameters,convenientassociated typeaccess,constraintsonassociatedtypes, retroactive modeling, type aliases, separate compilation of algorithms and datastructures, and implicit argument type deduction for generic algorithms. We find thatthesefeaturesarenecessarytoavoidawkwarddesigns,poormaintainability,andpainfullyverbose code. As languages increasingly support generics, it is important that languagedesignersunderstandthefeaturesnecessarytoenabletheeffectiveuseofgenericsandthattheirabsencecancausedifficultiesforprogrammers.Contents1 Introduction2 Generic Programming243 A Generic Graph Library84 Graph Library in C++1314171718212427294.14.2ImplementationEvaluationofC++5 Graph Library in Standard ML5.15.2ImplementationEvaluationofStandardML6 Graph Library in OCaml6.16.2ImplementationEvaluationofOCaml 2Garciaetal.7 Graph Library in Haskell3131333435364040424343454646494950525254565758607.17.2ImplementationEvaluationofHaskell8 Graph Library in Eiffel8.18.2ImplementationEvaluationofEiffel9 Graph Library in Java9.19.2ImplementationEvaluationofJava10Graph Library in C# generics10.1 Implementation10.2 EvaluationofC#generics11Graph Library in Cecil11.1 Implementation11.2 EvaluationofCecil12Discussion12.1 EncapsulatingTypeConstraintsinConcepts12.2 AccesstoAssociatedTypes12.3 ImplicitInstantiation12.4 EstablishingtheModelingRelation12.5 TypeAliases12.6 ConciseSyntax13Conclusion: Beyondfold andListReferences1 IntroductionGenericsareanincreasinglypopularandimportanttool forsoftwaredevelopmentand many modern programming languages provide basic support for them. Forexample,theuseoftype-safepolymorphiccontainersisroutineprogrammingprac-tice today. Some languages have moved beyond elementary generics to support-ing a broader, more powerful form of generic programming, enabling the devel-opment of highly reusable algorithms. Such extensive support for generics hasproven valuable in practice. Generic programming has been a particularly effec-tivemeansforconstructingreusablelibrariesofsoftwarecomponents,oneexampleofwhichistheStandardTemplateLibrary(STL),nowpartoftheC++StandardLibrary(Stepanov&Lee,1994;ISO1998).Asthegenericprogrammingparadigmgainsmomentum,theneedforaclearanddeepunderstandingofthelanguageis-suesincreases.Inparticular,itisimportanttounderstandwhatlanguagefeaturesarerequiredtosupportthisbroadernotionofgenericprogramming.To aid in this process, we present results of a study comparing eight program-ming languages that support generics: Standard ML (Milner et al., 1997), Objec-tive Caml (Leroy, 2000), C++ (ISO, 1998), Haskell (Peyton Jones et al. , 1999), LanguageSupportforGenericProgramming3Eiffel(Meyer,1992),Java(Goslingetal.,2005),C#(Kennedy&Syme,2001;Mi-crosoft Corporation, 2002), and Cecil (Litvinov, 1998). Seven of these languagescurrentlysupportgenerics,andtheyhavebeenimplementedandproposedforthenextrevisionofC#.Theselanguageswereselectedbecausetheyarewidelyusedorrepresentthestateoftheartinprogramminglanguageswithgenerics.Thispaperisarevisedandextendedversionof(Garciaetal.,2003),featuringupdatedanalysesandtheadditionoftwolanguages,ObjectiveCamlandCecil.Ourgoalsforthisstudywerethefollowing:• Tounderstandwhichlanguagefeaturesarenecessarytosupportgenericpro-gramming;• To understand the extent to which specific languages support generic pro-gramming;• Toprovideguidancefordevelopmentoflanguagesupportforgenerics;and• Toilluminateforthecommunitysomeofthepowerandsubtletiesofgenericprogramming.Itisdecidedlynotagoalofthispapertodemonstratethatanyonelanguageis“bet-ter”thananyother.Thispaperisalsonotacomparisonofgenericprogrammingtoanyotherprogrammingparadigm,beitobject-oriented,f
正在翻譯中..
結果 (中文) 3:[復制]
復制成功!
你喜欢什么` ` `玛丽
正在翻譯中..
 
其它語言
本翻譯工具支援: 世界語, 中文, 丹麥文, 亞塞拜然文, 亞美尼亞文, 伊博文, 俄文, 保加利亞文, 信德文, 偵測語言, 優魯巴文, 克林貢語, 克羅埃西亞文, 冰島文, 加泰羅尼亞文, 加里西亞文, 匈牙利文, 南非柯薩文, 南非祖魯文, 卡納達文, 印尼巽他文, 印尼文, 印度古哈拉地文, 印度文, 吉爾吉斯文, 哈薩克文, 喬治亞文, 土庫曼文, 土耳其文, 塔吉克文, 塞爾維亞文, 夏威夷文, 奇切瓦文, 威爾斯文, 孟加拉文, 宿霧文, 寮文, 尼泊爾文, 巴斯克文, 布爾文, 希伯來文, 希臘文, 帕施圖文, 庫德文, 弗利然文, 德文, 意第緒文, 愛沙尼亞文, 愛爾蘭文, 拉丁文, 拉脫維亞文, 挪威文, 捷克文, 斯洛伐克文, 斯洛維尼亞文, 斯瓦希里文, 旁遮普文, 日文, 歐利亞文 (奧里雅文), 毛利文, 法文, 波士尼亞文, 波斯文, 波蘭文, 泰文, 泰盧固文, 泰米爾文, 海地克里奧文, 烏克蘭文, 烏爾都文, 烏茲別克文, 爪哇文, 瑞典文, 瑟索托文, 白俄羅斯文, 盧安達文, 盧森堡文, 科西嘉文, 立陶宛文, 索馬里文, 紹納文, 維吾爾文, 緬甸文, 繁體中文, 羅馬尼亞文, 義大利文, 芬蘭文, 苗文, 英文, 荷蘭文, 菲律賓文, 葡萄牙文, 蒙古文, 薩摩亞文, 蘇格蘭的蓋爾文, 西班牙文, 豪沙文, 越南文, 錫蘭文, 阿姆哈拉文, 阿拉伯文, 阿爾巴尼亞文, 韃靼文, 韓文, 馬來文, 馬其頓文, 馬拉加斯文, 馬拉地文, 馬拉雅拉姆文, 馬耳他文, 高棉文, 等語言的翻譯.

Copyright ©2025 I Love Translation. All reserved.

E-mail: