3 ms·
I can hear the sound of a thousand LISP devs hurting in parens reading this comment lol. Macros, as with most things (including even goto!) have their place, t
by stingraycharles 4y ago
I can hear the sound of a thousand LISP devs hurting in parens reading this comment lol.
Macros, as with most things (including even goto!) have their place, the problem is when they’re abused. But to say they’re never useful ever and you should instead always rely on language features is not something I agree with, and could even lead to language bloat if you need a full fledged feature for every little thing which would be trivially solved with a macro.
- WalterBright 4y agoMy unfettered opinion is that Lisp has not really caught on because it relies on macros to make it useful. Every project invents their own language on top of Lisp, incompatible with anyone else's. It's like the problem with C++ before C++98. It had no string class, so everybody invented their own, all incompatible with everyone else's. BTW, everyone says that they understand my point and use macros modestly and responsibly. Nearly all of them go on to create their own undocumented impenetrable language out of those macros. It takes a programmer about 10 years of creating and using macros and dealing with other peoples' macros to come to the conclusion that the whole feature needs to be scrapped. Sadly, there aren't any shortcuts to this realization :-)
- WalterBright 4y agoIt also took the C++ community about 10 years to realize that the way iostreams was doing operator overloading to do pipelining was an abomination as well. In the D community, we also strongly discourage operator overloading for any purpose other than creating arithmetic types.
- tialaramex 4y agoI am doubtful that even WG21 as originally constituted would have accepted I/O Streams with its "Look at me, I've got operator overloading" operator abuse if it wasn't Stroustrup's own code. If some outsider had come along and said "Look at this slower, clumsier, operator abusing alternative to C's stdio" the committee might have quoted Stroustrups' own words condemning such abuse. "the ability to define new meanings for old operators can be used to write programs that are well nigh incomprehensible". I'm with you up to a point on overloading, if it were up to me for example Rust would not implement Add and AddAssign on String, and certainly Java wouldn't special case += but we are where we are. However Rust has several operators (fewer than C++ but still several) that aren't just for arithmetic types. Deref and DerefMut of course (used to implement smart pointers such as Arc), Index and IndexMut (for the indexing operator []) but also Try (implementation of the ? operator) and (though rather more distant into your future than Try if you write Stable Rust) the Function operator traits Fn, FnMut and FnOnce which represent callables. Of course arguably Rust isn't overloading operators at all. Rust has no subtyping, and so whether you can Add or Multiply or Try something is a matter only of whether that type implements the associated Trait.
- pjmlp 4y agoNot everyone shares that point of view. Gladly using iostreams since 1993.
- WalterBright 4y agoFortunately, I said "community" not "everyone"!
- pjmlp 4y agohttps://www.merriam-webster.com/dictionary/community https://www.merriam-webster.com/dictionary/community Unless you define "community" as those that do not share your point of view.
- WalterBright 4y agoSorry, "everyone" is your strawman.
- pjmlp 4y agoWhatever fits your concept of community.
- MrBuddyCasino 4y ago> My unfettered opinion is that Lisp has not really caught on because it relies on macros to make it useful. Every project invents their own language on top of Lisp, incompatible with anyone else's. Been saying this for years - this way of programming is powerful for the lone hacker, but lethal for team efforts. I will never forget the guy who ported some weird function evaluation framework from Clojure to a Java app and then left for greener pastures, what he left behind was the gnarliest of mindfucks.