Preview

Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS)

Advanced search

Pitfalls of C# Generics and Their Solution Using Concepts

https://doi.org/10.15514/ISPRAS-2015-27(3)-2

Abstract

In comparison with Haskell type classes and C++ concepts, such object-oriented languages as C# and Java provide much limited mechanisms of generic programming based on F-bounded polymorphism. Main pitfalls of C# generics are considered in this paper. Extending C# language with concepts which can be simultaneously used with interfaces is proposed to solve the problems of generics; a design and translation of concepts are outlined.

About the Authors

Julia Belyakova
Institute for Mathematics, Mechanics and Computer Science, Southern Federal University
Russian Federation


Stanislav Mikhalkovich
Institute for Mathematics, Mechanics and Computer Science, Southern Federal University
Russian Federation


References

1. R. Garcia, J. Jarvi, A. Lumsdaine, J. Siek, and J. Willcock, “An Extended Comparative Study of Language Support for Generic Programming”, J. Funct. Program., vol. 17, no. 2, pp. 145-205, Mar. 2007.

2. B. Stroustrup and G. Dos Reis, “Concepts - Design Choices for Template Argument Checking”, C++ Standards Committee Papers, Technical Report N1522=03-0105, ISO/IEC JTC1/SC22/WG21, October 2003.

3. G. Dos Reis and B. Stroustrup, “Specifying C++ Concepts”, in Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ser. POPL ’06. New York, NY, USA: ACM, 2006, pp. 295-308.

4. M. H. Austern, Generic Programming and the STL: Using and Extending the C++ Standard Template Library. Boston, MA, USA: Addison- Wesley Longman Publishing Co., Inc., 1998.

5. D. Gregor, J. Jarvi, J. Siek, B. Stroustrup, G. Dos Reis, and A. Lumsdaine, “Concepts: Linguistic Support for Generic Programming in C++”, in Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-oriented Programming Systems, Languages, and Applications, ser. OOPSLA ’06. New York, NY, USA: ACM, 2006, pp. 291-310.

6. B. Stroustrup and A. Sutton, “A Concept Design for the STL”, C++ Standards Committee Papers, Technical Report N3351=12-0041, ISO/IEC JTC1/SC22/WG21, January 2012.

7. J.-P. Bernardy, P. Jansson, M. Zalewski, S. Schupp, and A. Priesnitz, “A Comparison of C++ Concepts and Haskell Type Classes”, in Proceedings of the ACM SIGPLAN Workshop on Generic Programming, ser. WGP ’08. New York, NY, USA: ACM, 2008, pp. 37-48.

8. “System.Array.Sort(T) Method”, URL: http://msdn.microsoft. com/library/system.array.sort.aspx.

9. B. C. Oliveira, A. Moors, and M. Odersky, “Type Classes As Objects and Implicits”, in Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, ser. OOPSLA ’10. New York, NY, USA: ACM, 2010, pp. 341-360.

10. S. Wehr, R. Lmmel, and P. Thiemann, “JavaGI: Generalized Interfaces for Java”, in ECOOP 2007 Object-Oriented Programming, ser. Lecture Notes in Computer Science, E. Ernst, Ed., vol. 4609. Springer Berlin Heidelberg, 2007, pp. 347-372.

11. B. Greenman, F. Muehlboeck, and R. Tate, “Getting F-bounded Polymorphism into Shape”, in Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, ser. PLDI ’14. New York, NY, USA: ACM, 2014, pp. 89-99.

12. A. V. Aho, M. S. Lam, R. Sethi, and J. D. Ullman, Compilers: Principles, Techniques, and Tools (2Nd Edition). Boston, MA, USA: Addison- Wesley Longman Publishing Co., Inc., 2006, ch. Code Optimization.

13. E. Ernst, “Family Polymorphism”, in Proceedings of the 15th European Conference on Object-Oriented Programming, ser. ECOOP ’01. London, UK, UK: Springer-Verlag, 2001, pp. 303-326.

14. J. Jarvi, J. Willcock, and A. Lumsdaine, “Associated Types and Constraint Propagation for Mainstream Object-oriented Generics”, in Proceedings of the 20th Annual ACM SIGPLAN Conference on Object- oriented Programming, Systems, Languages, and Applications, ser. OOPSLA ’05. New York, NY, USA: ACM, 2005, pp. 1-19.

15. The Boost Graph Library: User Guide and Reference Manual. Boston, MA, USA: Addison-Wesley Longman Publishing Co., Inc., 2002.

16. J. G. Siek, “A Language for Generic Programming”, Ph.D. dissertation, Indianapolis, IN, USA, 2005.

17. [17]. “TreeSet[A] Class”, URL: http://www.scala-lang.org/api/current/ #scala.collection.mutable.TreeSet.


Review

For citations:


Belyakova J., Mikhalkovich S. Pitfalls of C# Generics and Their Solution Using Concepts. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2015;27(3):29-46. (In Russ.) https://doi.org/10.15514/ISPRAS-2015-27(3)-2



Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 2079-8156 (Print)
ISSN 2220-6426 (Online)