3 ms·
I’m still a novice functional programmer so this may be a dumb comment but I thought a lisp would be more thread safe due to immutable data structures.
by infiniteseeker 7y ago
I’m still a novice functional programmer so this may be a dumb comment but I thought a lisp would be more thread safe due to immutable data structures.
- PyroLagus 7y agoNot all fp languages are purely functional, and certainly not all lisps. In fact, the only lisp that I'm aware of that focuses on immutability is clojure. Granted, many lisp programmers may decide to keep their functions pure, but it's rarely enforced.
- ncmncm 7y agoLisp is not a functional language. Or, not an obligate-functional language. I.e. you can do functional if you like, but where it becomes a PITA, you can just assign. Because of that, many optimizations possible in obligate-functional languages are not safe. Because of that, you sometimes need to do your own such optimizations, non-functional-wise. But it is still easier to get fast code than in an obligate-functional language, because in the latter it is indefinitely hard to predict where such optimizations, where permitted, would actually happen; and in some cases they are not allowed anyway. The tradeoff is that in Lisp (as in other imperative languages) you have to do them yourself where you want them. But you can choose to do them only in hot paths, a tiny fraction of your code.