
Were templates an original feature of C++ or did they appear in a revision
of the langage ?
Because C++ appeared in 1982 and Haskell in 1990.
But of course, the ML languages are older, so maybe Bjarne Stoustrup took
inspiration from them. (Anyway, functional features picked up in the
mainstream imperative languages usually end up being just details that
doesn't save much code typing and that are powerless when compared with the
original functional features).
I cannot help smiling when I hear Java/C#/Python developers telling about
the "wondeful features" of their languages ;)
(- We have generators! We can _yield_ values! [1]
- Yeah, so nice... We have simple lists... with lazy evaluation)
(- We have type generics!
- Sigh...)
Had once a microsoft representative that came to my school to hold a lecture
about C#/LINQ. Told us during fifteen minutes about their python-like
"yield" feature. Yay.... And to say some of my teachers were in awe [2].
[1] Amusing fact: this was me, a few years ago.
[2] Well, of course, with a Java background.
2011/6/8 Alexander Solla
On Wed, Jun 8, 2011 at 2:00 AM, Malcolm Wallace
wrote: More seriously, the influence of Haskell over F# (and even Python) is undoubted, but do you really think Haskell influenced Java Generics? (IMHO they were more inspired from C++ templates) (That is a question, not an assertion).
Phil Wadler had a hand in designing both Haskell and Java Generics I believe.
As far as I understand, Java/C# Generics and C++ templates "are" merely keywords around what we Haskellers call "parametric polymorphism". In other words, our type language is rich enough to express types like:
stringConcat :: [String] -> String
and
concat :: Monoid a => [a] -> a
using the "same" typing language, whereas the C-style languages require annotations. (You can probably guess which I prefer. I don't need keywords to tell me what the code describes, then the code describes it so clearly)
I can't find any literature that specifically credits functional languages for the feature, but Bjarne Stoustrup himself acknowledges that functional programmers would tend to find template metaprogramming easier than others. He was probably aware of functional implementations (Haskell? Miranda? ML?) when he said that.
I don't see the connection between Haskell's typeful programming and Python. List comprehensions are set-builder-notation-like syntactic sugar for lists. I didn't use them in Python and I don't use them in Haskell.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe