17

Which was the first language with generic programming support, and what was the first major staticly typed language (widely used) with generics support.

Generics implement the concept of parameterized types to allow for multiple types. The term generic means "pertaining to or appropriate to large groups of classes."

I have seen the following mentions of "first":

First-order parametric polymorphism is now a standard element of statically typed programming languages. Starting with System F [20,42] and functional programming lan- guages, the constructs have found their way into mainstream languages such as Java and C#. In these languages, first-order parametric polymorphism is usually called generics.

From "Generics of a Higher Kind", Adriaan Moors, Frank Piessens, and Martin Odersky

Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters. This approach, pioneered by Ada in 1983

From Wikipedia Generic Programming

4 Answers 4

10

A bit earlier than Ada: http://en.wikipedia.org/wiki/Hindley-Milner#algorithm

First widely used implementation is http://en.wikipedia.org/wiki/ML_programming_language

3

Probably Lisp. It was more or less doing that in the 1960's. In fact if the question is what was the first language to do pretty much anything of note you will probably find it was lisp. Its kind of scary to realize that the cool new feature in language X was in fact the cool new feature of lisp in 1960!

4
  • 11
    Lisp was not statically typed so "generics" doesn't even make sense in that context.
    – Rufflewind
    Commented Oct 1, 2014 at 18:52
  • Well "Generics" only make sense for some kinds of static typing. There are many kinds of type systems that have different properties.
    – Zachary K
    Commented Oct 1, 2014 at 19:18
  • 1
    @ZacharyK The specific type system feature meant by "generics" is paramteric polymorphism, which doesn't make sense in untyped languages.
    – Jack
    Commented Sep 28, 2016 at 0:04
  • 1
    Not a very useful answer.
    – Miau
    Commented Sep 28, 2020 at 14:41
2

Before generics there were templates, and before that macro substitution.

3
  • 2
    Templates are not parametric polymorphism, which is what most people mean when they say "generics" in the context of types. Templates and macros aren't even tied to type systems, they're an orthogonal feature altogether.
    – Jack
    Commented Sep 28, 2016 at 0:03
  • 1
    This answer confuses "Java generics" with "generic programming".
    – Kaz
    Commented Aug 31, 2017 at 18:58
  • This answer confuses matters
    – Miau
    Commented Sep 28, 2020 at 14:42
1

CLU had parametrised types https://en.wikipedia.org/wiki/CLU_(programming_language) and it was added around the same time as ML (early 70s)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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