Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Im trying to work out if generic programming was a functional programming feature which was then introduced into Java, C++ and C# or did the latter copy it from the functional programming languages like Haskell, Lisp, OCaml etc?

Google is giving me lots on what generic programming is, but not where it originated. All I can see is that Ada implemented it early on.

Would you class it as a functional programming technique?

share|improve this question

migrated from stackoverflow.com Nov 11 '11 at 15:24

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 4 down vote accepted

Polymorphic data types had been around since early 1970s (with the introduction of ML language and Hindley-Milner algorithm).

A more generic form, Lisp macros, had been around since 1960s.

share|improve this answer

According to the Wikipedia article it stems from Ada and/or CLU (both of which are object oriented programming languages):

This approach, pioneered by Ada in 1983, permits writing common functions or types that differ only in the set of types on which they operate when used,

[...]

Generic programming facilities first appeared in the 1970s in languages like CLU and Ada

share|improve this answer
    
After that bit it then describes that generic programming was useful for mathematical problems....... which sounded slightly functional? –  user997112 Nov 11 '11 at 15:03
1  
Why do you say that? Object oriented programming can solve mathematical problems, no? Besides, I can't find that sentence. If I search for "math" on that page, all that comes up is an unrelated sentence. –  aioobe Nov 11 '11 at 15:04
    
Lisp macros predate both of those references, I believe, and can certainly be used for C++-style generic programs. I don't know how much static typing these Lisps used, although the earliest one I used had strong dynamic typing. I don't know how much generic programming was actually done; much of the benefits of C++-style generics come from having a static type system. –  David Thornley Nov 11 '11 at 16:35
2  
It's also worth nothing that Ada 83 does not fit most definitions of "object oriented" -- it wasn't really until Ada 95 that it got the usual object oriented features (especially inheritance). –  Jerry Coffin Nov 11 '11 at 18:31

Like for many great ideas in computing, any "first" you can identify probably wasn't the actual first use. For example, Christopher Strachey discusses the idea (under the label "polymorphism") in his influential 1967 lecture notes without giving attributions so the idea is likely to have been well known by that time.

At that time, there was no great split between functional and object-oriented programming.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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