3

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++

Louie Bacaj
  • 143
  • 4

1 Answers1

8

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.

amon
  • 132,749
  • 27
  • 279
  • 375
  • 4
    It isn't just distinguishing of MLs, it was invented by ML in 1973. –  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 00:04