7 ms·
I use Common Lisp rather than Clojure at work. - During refactoring, do you feel more flexible, or less? A lot of it depends on how the code has been written.
by weavie 8y ago
I use Common Lisp rather than Clojure at work.
- During refactoring, do you feel more flexible, or less?
A lot of it depends on how the code has been written. There are definitely parts of our code base that I really dread going near and there have been plenty of times when I have broken stuff by making a change without fully understanding the code. It is quite easy to write incomprehensible lisp code.
With Clojure being more pure and opinionated things are probably not quite as hairy as it can get in CL. But if you write your code well CL can be fairly easy to refactor. Generally preferring to use CLOS (the object system) rather that just property lists and hash tables will give you some typing information that can make life a lot easier. Avoid nested lists as data structures - there is nothing worse than code that does stuff like `(dosomething (cadar list) (cddar list)`
- Do you make use of the Lispy-ness?
Macros tend to only be used for writing framework code. There is generally no need to use them when writing business logic.
The aspect of Lisp that is often not mentioned is the iterative development. When code is data it becomes possible to evaluate code against a running system. This is, in my opinion, the nicest feature of Lisp. No compile times, you can change code on the fly, evaluate and test functions as you are writing them. Development becomes a real conversation with the compiler. You can even connect into the live server if needed to debug problems.
- Do you wish you had static types?
Yes.