←back to thread

110 points jackdaniel | 4 comments | | HN request time: 0.824s | source
Show context
adamddev1 ◴[] No.44972696[source]
Ah, in an alternate world where Brendan Eich wasn't pressured by his superiors to make JS more Java-like, we could have had something like this as very normal.

I wonder how much faster that would have pushed the world into FP ideas. While sometimes I prefer the bracket/C syntax, I wonder how things would have evolved if JS was a lisp originally. Instead of things moving to TypeScript, would they be moving to something like typed Lisp or OCaml, or PureScript ?

replies(5): >>44973351 #>>44973702 #>>44976138 #>>44976751 #>>44977298 #
umanwizard ◴[] No.44973702[source]
Is CL really particularly more “functional” than JavaScript? I don’t know CL but I know it bears some passing similarity to Emacs Lisp, which is usually written in a pretty imperative style. Sure, it has first-class closures but so does JS.
replies(6): >>44973781 #>>44973976 #>>44974501 #>>44975807 #>>44976563 #>>44984186 #
1. iLemming ◴[] No.44975807[source]
Both CL and Elisp are arguably more functional than Javascript in several key ways - Immutable data by convention, First-class function from the start (js added this later), powerful higher-order function are more idiomatic, lexical closures, FP culture that goes back decades. JS has caught up in some aspects - arrow functions, array methods, const, libs like Rambda.

I think, Lisp in general is very flexible - you can write imperatively, or you can do more FP; if you need object-orientation - you have it, polymorphic dispatch - sure why not?, etc., etc.

replies(1): >>44983454 #
2. xigoi ◴[] No.44983454[source]
I object to the claim that a Lisp-2 has first-class functions.
replies(1): >>45001058 #
3. iLemming ◴[] No.45001058[source]
What? Functions can be passed as arguments? Check! Returned from functions? Check! Stored in variables? Check! Lisp-2 just means functions and vars live in separate namespaces, that's all. In every other aspect they are first-class.
replies(1): >>45002704 #
4. xigoi ◴[] No.45002704{3}[source]
The separate namespaces mean that functions are considered as something fundamentally different from other values.