3 ms·
The whole point of Lisp is to allow you, the programmer, to make the language that makes it easiest to write the program you're trying to write. Said language w
by reikonomusha 2y ago
The whole point of Lisp is to allow you, the programmer, to make the language that makes it easiest to write the program you're trying to write. Said language will be syntactic abstractions in Lisp primarily built out of Lisp macros, but there are additional means available to integrate your language idea into Lisp outside of macros.
So, really, Lisp is in exact agreement with your position, with one proviso: Pick the language that makes it easiest to write the program you're trying to write—and express that language in Lisp.
Case in point: Lisp does have a powerful type system that rivals Haskell. Full type inference, multi-parameter type classes, parametric polymorphism. It's called Coalton[1], and it's... just another Lisp library.
Whether or not you can be bothered to spend the effort to align Lisp to your domain is another question, but the mere fact it's both possible and reasonable to do is a testament to what some people mean by statements like "Lisp is powerful".
[1] https://github.com/coalton-lang/coalton https://github.com/coalton-lang/coalton
- kazinator 2y agoThis idea was popularized by Graham who wrote (in the very article this submission is about) that 20-25% of the Viaweb source code was macros, and made careless hyperbole like: "Programs that write programs? When would you ever want to do that? Not very often, if you think in Cobol. All the time, if you think in Lisp." The idea has become oversold, and has caused some harm by giving rise to the circulation of reactionary "Lisp curse" type misinformation. Lisps are useful without the application programmer writing a single macro. Most Lisp coding style guides include a few words to discourage the writing of new macros. Macros, as such, help Lisp dialects themselves grow. That in turn helps programmers need to write fewer macros of their own. Macros are great for managing language growth and versioning. One example is that, within certain limits, it's easier to make a Lisp program work with an old version of its language implementation in which certain newer macros are missing, than to make programs in other kinds of languages work with older language implementations in which syntax is missing. Programmers using Lisp but not writing macros are certainly not missing the point of Lisp, let alone the entire point. You do not think about programs writing programs "all the time" when coding in Lisp; it is hyperbole.
- reikonomusha 2y agoI disagree with you on many points. I do not claim that not using macros means that one cannot use Lisp usefully or profitably. It's a wonderful language even without macros, and I'm sure I'm preaching to the choir by listing all the reasons why. However, I do think adamantly that the "point" of Lisp really is syntactic abstraction. Why have S-expressions, code-as-data, symbolic data types, etc. otherwise? All of that is there to enable syntactic abstraction. If out-of-the-box Lisp is sufficient to express solutions to your problems reasonably, then I would wholeheartedly agree to not write macros. But if it doesn't? Well, Lisp is ready to offer a platform to make it happen. Lisp macros have been given a bad rap because of the plethora of almost useless examples of them. In any beginner book about Lisp, much ink will be spilt in little shorthands, like aif, with-gensyms, etc. Better examples would be actual, real life DSLs people use, like LOOP, lexical analyzers, web server routing, parallelization primitives, static typing, infix notation, etc. Things where gobs of functions and classes don't really capture the best way to denote the solution to a problem. Learning about macros, then being advised to never use them, to me, is miscommunication at best, a grave misunderstanding at worst.