Language support for generic programming in object-oriented languages: design challenges
Автор: Belyakova Julia
Журнал: Труды Института системного программирования РАН @trudy-isp-ran
Статья в выпуске: 2 т.28, 2016 года.
Бесплатный доступ
It is generally considered that object-oriented (OO) languages provide weaker support for generic programming (GP) as compared with functional languages such as Haskell or SML. There were several comparative studies which showed this. But many new object-oriented languages have appeared in recent years. Have they improved the support for generic programming? And if not, is there a reason why OO languages yield to functional ones in this respect? In the earlier comparative studies object-oriented languages were usually not treated in any special way. However, the OO features affect language facilities for GP and a style people write generic programs in such languages. In this paper we compare ten modern object-oriented languages and language extensions with respect to their support for generic programming. It has been discovered that every of these languages strictly follows one of the two approaches to constraining type parameters. So the first design challenge we consider is “which approach is better”. It turns out that most of the explored OO languages use the less powerful one. The second thing that has a big impact on the expressive power of a programming language is language support for multiple models. We discuss pros and cons of this feature and its relation to other language facilities for generic programming.
Object-oriented languages, generic programming, generics, types, constraints, concepts, interfaces, concept pattern, multiple models, concept-parameters
Короткий адрес: https://sciup.org/14916346
IDR: 14916346 | DOI: 10.15514/ISPRAS-2016-28(2)-1
Список литературы Language support for generic programming in object-oriented languages: design challenges
- J. Belyakova. Language Support for Generic Programming in Object-Oriented Languages: Peculiarities, Drawbacks, Ways of Improvement. To appear in Lecture Notes in Computer Science, 2016.
- D. R. Musser, A. A. Stepanov. Generic Programming. Proceedings of the International Symposium ISSAC’88 on Symbolic and Algebraic Computation, ISAAC ’88, London, UK, UK: Springer-Verlag, 1989, pp. 13-25.
- R. Garcia et al. An Extended Comparative Study of Language Support for Generic Programming. J. Funct. Program., Mar. 2007, 17(2), pp. 145-205.
- J.-P. Bernardy et al. A Comparison of C++ Concepts and Haskell Type Classes. Proceedings of the ACM SIGPLAN Workshop on Generic Programming, WGP ’08, Victoria, BC, Canada: ACM, 2008, pp. 37-48.
- R. Garcia et al. A Comparative Study of Language Support for Generic Programming. SIGPLAN Not., Oct. 2003, 38(11), pp. 115-134.
- B. Oliveira, J. Gibbons. Scala for Generic Programmers: Comparing Haskell and Scala Support for Generic Programming. J. Funct. Program. July 2010, 20(3-4), pp. 303-352.
- S. Wehr, P. Thiemann. JavaGI: The Interaction of Type Classes with Interfaces and Inheritance. ACM Trans. Program. Lang. Syst., July 2011, 33(4), pp. 12:1-12:83.
- J. G. Siek, A. A. Lumsdaine. Language for Generic Programming in the Large. Sci. Comput. Program., May 2011, 76(5), pp. 423-465.
- J. Belyakova, S. Mikhalkovich. Pitfalls of C# Generics and Their Solution Using Concepts. Proceedings of the Institute for System Programming, June 2015, 27(3), pp. 29-45.
- Y. Zhang et al. Lightweight, Flexible Object-oriented Generics. Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2015, Portland, OR, USA: ACM, 2015, pp. 436-445.
- P. Canning et al. F-bounded Polymorphism for Object-oriented Programming, Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture, FPCA ’89, Imperial College, London, United Kingdom: ACM, 1989, pp. 273-280.
- K. Bruce et al. On Binary Methods. Theor. Pract. Object Syst., Dec. 1995, 1(3), pp. 221-242.
- A. Kennedy, D. Syme. Design and Implementation of Generics for the.NET Common Language Runtime. SIGPLAN Not., May 2001, 36(5), pp. 1-12.
- J. Belyakova, S. Mikhalkovich. A Support for Generic Programming in the Modern Object-Oriented Languages. Part 1. An Analysis of the Problems. Transactions of Scientific School of I. B. Simonenko. Issue 2, 2015, no. 2, pp. 63-77.
- J. Järvi, J. Willcock, A. Lumsdaine. Associated Types and Constraint Propagation for Mainstream Object-oriented Generics. Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, OOPSLA ’05, San Diego, CA, USA: ACM, 2005, pp. 1-19.
- A. Martelli, U. Montanari. An Efficient Unification Algorithm, ACM Trans. Program. Lang. Syst., Apr. 1982, 4(2), pp. 258-282.
- The Ceylon Language Specification, version 1.2.2 (March 11, 2016). http://ceylon-lang.org/documentation/1.2/spec/
- The Kotlin Reference, version 1.0 (February 11, 2016). https://kotlinlang.org/docs/reference/
- Java Platform, Standard Edition (Java SE) 8. http://docs.oracle.com/javase/8/
- B. C. Oliveira, A. Moors, M. Odersky. Type Classes As Objects and Implicits. Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA ’10, Reno/Tahoe, Nevada, USA: ACM, 2010, pp. 341-360.
- A. Pelenitsyn. Associated Types and Constraint Propagation for Generic Programming in Scala. Programming and Computer Software, 2015, 41(4), pp. 224-230.
- The Rust Reference, version 1.7.0 (March 3, 2016). http://doc.rust-lang.org/stable/reference.html
- C. V Hall. et al. Type Classes in Haskell. ACM Trans. Program. Lang. Syst., Mar. 1996, 18(2), pp. 109-138.
- P. Wadler, S. Blott. How to Make Ad-hoc Polymorphism Less Ad Hoc. Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’89, Austin, Texas, USA: ACM, 1989, pp. 60-76.
- B. Stroustrup. Concept Checking -A More Abstract Complement to Type Checking. Technical Report N1510=03-0093, ISO/IEC JTC1/SC22/WG21, C++ Standards Committee Papers, 2003.
- B. Stroustrup, G. Dos Reis. Concepts -Design Choices for Template Argument Checking. Technical Report N1522=03-0105, ISO/IEC JTC1/SC22/WG21, C++ Standards Committee Papers, 2003.
- G. Dos Reis, B. Stroustrup. Specifying C++ Concepts. Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’06, Charleston, South Carolina, USA: ACM, 2006, pp. 295-308.
- B. Stroustrup, A. Sutton. A Concept Design for the STL. Technical Report N3351=12-0041, ISO/IEC JTC1/SC22/WG21, C++ Standards Committee Papers, 2012.
- A. A. Stepanov, M. Lee. The Standard Template Library. Technical Report 95-11(R.1), HP Laboratories, 1995.
- A. Sutton. C++ Extensions for Concepts PDTS. Technical Specification N4377, ISO/IEC JTC1/SC22/WG21, C++ Standards Committee Papers, 2015.
- B. Greenman, F. Muehlboeck, R. Tate. Getting F-bounded Polymorphism into Shape. Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’14, Edinburgh, United Kingdom: ACM, 2014, pp. 89-99.
- L. White, F. Bour, J. Yallop. Modular Implicits. ArXiv e-prints, Dec. 2015, arXiv: 1512.01895 .