3 ms·
>> The mental energy it takes to write the 30 lines of Go is probably lower than the mental energy is takes to write those 5 lines of lisp. I would use more me
by smnplk 5y ago
>> The mental energy it takes to write the 30 lines of Go is probably lower than the mental energy is takes to write those 5 lines of lisp.
I would use more mental energy to write 30 lines of Go, than 5 in lisp. Also if you take into account that you have a true REPL and you can do REPL driven development, which spares you some extra mental energy.
But to be fair, Paul is talking about macros, which Go doesn't even have.Macros are more complicated, but are often oversold and over hyped. Yes, they are great, you can extend the language and all, but macros are not that often used, you can probably pick a random lisp codebase and search for macros, I bet you won't find any or less than 2% of the entire codebase. If macros in lisp didn't exist I would still use it, because I love building expressions vs building statemets.
- lispm 5y ago> I bet you won't find any or less than 2% of the entire codebase One can look from another angle into some code bases: https://github.com/McCLIM/McCLIM/blob/master/Examples/stopwatch.lisp https://github.com/McCLIM/McCLIM/blob/master/Examples/stopwa... It uses a ton of complex macros: Built in macros: DEFPACKAGE, DEFMETHOD, MULTIPLE-VALUE-BIND, LOOP, ... Language extensions: WHEN-LET, ... Library macros: WITH-OUTPUT-AS-PRESENTATION, FORMATTING-TABLE, DEFINE-APPLICATION-FRAME, ... Even a generated macro: DEFINE-STOPWATCH-COMMAND (which was defined by DEFINE-APPLICATION-FRAME)
- smnplk 5y agoThere is only one custom macro definition in this code, 10 lines of code without docstring. Builtin macros are not an issue, why would that be an issue ? Those are just part of the language standard library. It's the same as when you use reserved words in other languages, like *import* statement in golang or *ns* macro in Clojure, it's just part of the language and you learn how to use it. I was talking about custom macros. Disclamer: My goto lisps are Clojure and Janet, so I am not very familiar with CL.
- hsn915 5y agoGo doesn't have macros but it culturally encourages code generation. I myself generate hundreds of lines of code that would otherwise be annoying and error-prone to maintain manually.
- blacktriangle 5y agoThis may be the first time I've ever seen code generation listed as a feature. Code generation may be the single biggest contributor to long-term maintainability problems I've ever seen, from `rails new` to create-react-app, over time it'll kill your momentum.