ABSTRACT
The Microsoft.NET Common Language Runtime provides a shared type system, intermediate language and dynamic execution environment for the implementation and inter-operation of multiple source languages. In this paper we extend it with direct support for parametric polymorphism (also known as generics), describing the design through examples written in an extended version of the C# programming language, and explaining aspects of implementation by reference to a prototype extension to the runtime.
Our design is very expressive, supporting parameterized types, polymorphic static, instance and virtual methods, “F-bounded” type parameters, instantiation at pointer and value types, polymorphic recursion, and exact run-time types. The implementation takes advantage of the dynamic nature of the runtime, performing just-in-time type specialization, representation-based code sharing and novel techniques for efficient creation and use of run-time types.
Early performance results are encouraging and suggest that programmers will not need to pay an overhead for using generics, achieving performance almost matching hand-specialized code.
- 1.The .NET Common Language Runtime. See website at http://msdn.microsoft.com/net/.Google Scholar
- 2.O. Agesen, S. Freund, and J. C. Mitchell. Adding parameterized types to Java. In Object-Oriented Programming: Systems, Languages, Applications (OOPSLA), pages 215-230. ACM, 1997.Google Scholar
- 3.P. N. Benton, A. J. Kennedy, and G. Russell. Compiling Standard ML to Java bytecodes. In 3rd ACM SIGPLAN International Conference on Functional Programming, September 1998. Google ScholarDigital Library
- 4.Gilad Bracha, Martin Odersky, David Stoutamire, and Philip Wadler. Making the future safe for the past: Adding genericity to the Java programming language. In Object-Oriented Programming: Systems, Languages, Applications (OOPSLA). ACM, October 1998. Google ScholarDigital Library
- 5.Peter S. Canning, William R. Cook, Walter L. Hill, John C. Mitchell, and William Olthoff. F-bounded quantification for object-oriented programming. In Conference on Functional Programming Languages and Computer Architecture, 1989. Google ScholarDigital Library
- 6.R. Cartwright and G. L. Steele. Compatible genericity with run-time types for the Java programming language. In Object-Oriented Programming: Systems, Languages, Applications (OOPSLA), Vancouver, October 1998. ACM. Google ScholarDigital Library
- 7.R. C. H. Connor. Types and Polymorphism in Persistent Programming Systems. PhD thesis, University of St. Andrews, 1990.Google Scholar
- 8.A. Gordon and D. Syme. Typing a multi-language intermediate code. In 27th Annual ACM Symposium on Principles of Programming Languages, January 2001. Google ScholarDigital Library
- 9.R. Harper and G. Morrisett. Compiling polymorphism using intensional type analysis. In 22nd Annual ACM Symposium on Principles of Programming Languages, January 1995. Google ScholarDigital Library
- 10.X. Leroy. Unboxed objects and polymorphic typing. In 19th Annual ACM Symposium on Principles of Programming Languages, pages 177-188, 1992. Google ScholarDigital Library
- 11.T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison-Wesley, second edition, 1999. Google ScholarDigital Library
- 12.Y. Minamide. Full lifting of type parameters. Technical report, RIMS, Kyoto University, 1997.Google Scholar
- 13.A. Myers, J. Bank, and B. Liskov. Parameterized types for Java. In 24th Annual ACM Symposium on Principles of Programming Languages, pages 132-145, January 1997. Google ScholarDigital Library
- 14.M. Odersky, P. Wadler, G. Bracha, and D. Stoutamire. Pizza into Java: Translating theory into practice. In ACM Symposium on Principles of Programming Languages, pages 146-159. ACM, 1997. Google ScholarDigital Library
- 15.Martin Odersky, Enno Runne, and Philip Wadler. Two Ways to Bake Your Pizza - Translating Parameterised Types into Java. Technical Report CIS-97-016, University of South Australia, 1997.Google Scholar
- 16.M. Viroli and A. Natali. Parametric polymorphism in Java: an approach to translation based on reflective features. In Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA). ACM, October 2000. Google ScholarDigital Library
- 17.M. Viroli and A. Natali. Parametric polymorphism in Java through the homogeneous translation LM: Gathering type descriptors at loadtime. Technical Report DEIS-LIA-00-001, Universit~ degli Studi di Bologna, April 2000.Google Scholar
Index Terms
- Design and implementation of generics for the .NET Common language runtime
Recommendations
Formalization of generics for the .NET common language runtime
POPL '04: Proceedings of the 31st ACM SIGPLAN-SIGACT symposium on Principles of programming languagesWe present a formalization of the implementation of generics in the .NET Common Language Runtime (CLR), focusing on two novel aspectsof the implementation: mixed specialization and sharing, and efficient support for run-time types. Some crucial ...
Formalization of generics for the .NET common language runtime
POPL '04We present a formalization of the implementation of generics in the .NET Common Language Runtime (CLR), focusing on two novel aspectsof the implementation: mixed specialization and sharing, and efficient support for run-time types. Some crucial ...
Design and implementation of generics for the .NET Common language runtime
The Microsoft.NET Common Language Runtime provides a shared type system, intermediate language and dynamic execution environment for the implementation and inter-operation of multiple source languages. In this paper we extend it with direct support for ...
Comments