Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Calling JavaScript a functional language on the pure basis that it has first class functions and closures is sort of stupid. Aside from that, what other properties does JS enforce that are deemed functional?

I'll save you some time: none.



I don't generally like to say sort of stupid things, but I would call a language functional if it has first class functions and closures.


Provide a concise, objective definition for functional languages which Lisp, Scala, Haskell, and Lua satisfy but Javascript does not.


The language uses functions as the primary mechanism for implementing core language design features, such as abstraction, modularity, code re-use, and configurable behavior. Lisp, Scala, and Haskell use functions as their go-to tool, supported by macros and/or types. JavaScript uses objects and its object system as its primary tool, with functions in a supporting role.

I will concede that JavaScript supports programming in a functional style. However, if one uses that as the definition of a functional language, the term becomes nearly useless, basically excluding only Java.


You might add that Lisp (well Scheme and some Common Lisps), Scala, and Haskell provide mechanisms to make recursion equivalent to iteration without explicit looping constructs that require mutation (tail recursion).


My interest in having a boring argument with a language bigot approaches nil. But yes, aside from the very namesake of functional programming (a vague language grouping with no disciplined definition), yeah there's nothing else there...groan.


You are correct in saying that functional programming has a vague meaning. For JavaScript, I'll accept the meaning:

    functional: adj, produces a correct result
      example usage: Despite its many warts, inadequacies,
        somehow JavaScript is actually functional.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: