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.

Highlights

  • Generic programming is supported in different programming languages by various techniques such as C++ templates, C# and Java generics, Haskell type classes, etc

  • Investigating generics and several approaches to revising OO interfaces, we faced with some pitfalls of these solutions which were not considered yet

  • Recursive constraints used to solve the binary method problem appear to be rather complex and often do not correspond a semantics assumed by a programmer

Read more

Summary

Introduction

Generic programming is supported in different programming languages by various techniques such as C++ templates, C# and Java generics, Haskell type classes, etc. Some of these techniques were found more expressive and suitable for generic programming, other ones more verbose and worse maintainable [1]. In comparison with concepts and Haskell type classes [1], [7], such mainstream object-oriented languages as C# and Java provide much limited mechanisms of generic programming based on F-bounded polymorphism. While the concepts design proposed in the paper could be adapted for Java (and for any .NET-language with interface-based generics), the technique of language extension translation (which we consider in Sec. 4) cannot be applied for Java directly.

Lack of Retroactive Interface Implementation
Drawbacks of Recursive Constraints
Ambiguous Semantics of Generic Types
The Problem of Multi-Type Constraints
Constraints Duplication and Verbose Type Parameters
Related Work
JavaGI
Interfaces and Concepts
Conclusion and Future Work
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.