> Javascript is an excellent language for functional > programming, but it really should have a functional style > standard library, and sugar for lambda's.
Yes, I agree that JavaScript is a quite well-designed language, with a somewhat unknown capability for functinal programming (http://www.crockford.com/), and it does lambdas and closures nicely (even if you might "sugar" the lambda syntax even more, as you say).
However, it doesn't have native support for currying, although it can be done (http://www.svendtofte.com/code/curried_javascript/). I guess that's what I was thinking of regarding higher-order programming. You can indeed pass and return functions to/from functions.
> I agree about Java though ;-)
What, isn't anonymous inner classes a nice hack^H^H^H^Hfeature? :)
> If languages had the > standard functions to do the most common things on > collections already built in, then the few times when you > had to use function pointers in C or functors in Java to > define some custom operation would not be such a big deal.
Ever heard of a language named C++? STL anyone?
Few other points for this discussion in general:
Functional programming not only has future, it also has past and present, alongside objects and generic programing (please, do not mix Java generics here - Sun got stuck in backward compatibility issues and the best they could come up with under the circumstances was angle-bracketed cast syntax dubbed "generics").
A well-balanced and thought out approach is called multi-paradigm programming and is very well explained in this FAQ:
The above article explains how and when non-member functions can actually improve encapsulation.
In the end, let me say that it does not cease to amaze me how crowd gets pulled around by either marketing machines with a technology "de jour" - the most recent example being OO (Objects Only), or religious language-zealotry groups about exclusive and superior qualities of certain programming styles regardless of circumstances.
There are good and bad things about any mainstream programming style. The art is to find the optimal balance between them and succesfully apply it.
Flat View: This topic has 61 replies
on 5 pages
[
«
|
2345
]