I am writing a paper on the tension between OOP and Generic programming created by Stepanov. He widely criticizes OOP and says it is "technically flawed" when compared to Generic Programming.

Now I know we have plenty of programming languages that support OOP exclusivley and have no Generic support including Google GO for example, that is a modern language that they chose not to implement Generics because of their complexity. I know we have plenty of languages that support both Generics and OOP, for example C++ and Stepanov's famous STL library.

My question is: Do we have any modern programming languages or any at all that support Generics exclusively without OOP?

EDIT: I would like to add I tried looking around and cant seem to find much so I figured I would ask here.

Just to add that when I refer to Generic vs Object Oriented Programming I am refering to:

Generic Vs Object Oriented Programming

On the Tension Between Object-Oriented and Generic Programming in C++

closed as off-topic by gnat, user53019, user40980, Doc Brown, user7007 Dec 16 '13 at 16:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, Community, Community, Doc Brown, Community
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    SML & Haskell are good examples – Simon Bergot Dec 16 '13 at 13:11
  • Thanks Simon, most of my experience is with languages like C#, Java and C++ and just starting to learn a bit about Haskell and the likes. – Louie Bacaj Dec 16 '13 at 16:46
  • Ada 83 would be another to consider. To an extent, most Lisps are as well (other than those like Common Lisp, which also supports OO). – Jerry Coffin Dec 17 '13 at 5:03

Generic programming encompasses more than just “Generics”, which in turn is another name for parametric polymorphism. This concept is rather widespread and not constrained to object-oriented languages. It is a distinguishing feature of the ML language family which includes Standard ML, Ocaml (which also supports OOP, but is primarily functional) and Haskell.

Parametric polymorphism isn't the only way to do generic programming. For example, macro systems (like templates in C++) or a dynamic type system are other ways.

However, OOP in its various flavours is another good and widespread way to do generic programming, e.g through the use of interfaces (or an equivalent concept) or duck typing. In this sense Go is generic, as a function in that language can take an argument that is only defined by its interface.

  • 4
    It isn't just distinguishing of MLs, it was invented by ML in 1973. – World Engineer Dec 15 '13 at 23:39
  • That is a pretty great explanation, so basically "Generics" as Stepanov implemented them in C++ have been around for a long time in some of ML languages you described. – Louie Bacaj Dec 16 '13 at 0:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.