1 / 11
文档名称:

An Introduction to Generics of a Higher Kind in Scala:在一种更高的仿制药介绍Scala.pdf

格式:pdf   页数:11页
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

An Introduction to Generics of a Higher Kind in Scala:在一种更高的仿制药介绍Scala.pdf

上传人:薄荷牛奶 2016/3/29 文件大小:0 KB

下载得到文件列表

An Introduction to Generics of a Higher Kind in Scala:在一种更高的仿制药介绍Scala.pdf

文档介绍

文档介绍:An Introduction to Generics of a Higher Kind in Scala Lukas Felber January 8, 2010 Abstract Scala is a general purpose programming language designed to ex- mon programming patterns in a concise, elegant, and type- safe way. It smoothly integrates features of object-oriented and func- tional languages. Compared to languages like Java, C# or C++, there are many new noteworthy features. In this article, one of those, namelygenerics of a higher Kind, will be introduced to you. This Scala feature introducesgeneric types as?rst class types. This is done by implementingtype constructor polymorphism. We discuss the limitations of other languages which are solved in Scala withtype constructor polymorphism, by explaining its basic con- cepts and providing signi?cant examples in Scala and Java. 1 Introduction This article contains code sequences in the programming language Scala and Java. I do expect that the reader has a basic knowledge of those two languages. Thus I will not give any language introduction and refer for un- experienced readers to [8] for Scala and [6] for Java language introductions. The information found in this paper origins mainly form the papers [5] and [4] which where both (co-) authored by Martin Odersky who is the creator of the Scala language at theSwiss Federal Institute of Technology (EPFL) in Lausanne, Switzerland. When looking at other literature which also discusseshigher kind gener- ics, there are cases where, what we here refer to asgeneric types, is called abstract type. These terms imply the same construct. Almost any papers which concerns itself withgenerics of a higher kind (. [5, 4]) uses as code example an implementation ofIterable. Since the subject at hand requires very speci?c code patterns, there is no other useful construct which pete againstIterablein means pactness, simplicity and high pro?le. This is the reason why also here in this paper, the example code will be a strongly simpli?edIterableimplementation. 1 In Section