5 ms·
M4 always was horrible, and I say that as the original author of GNU M4
- ctrw 3y agoM4 is an amazing tool and the only programming language to get quotation/evaluation right. This confuses everyone as no other language treats quotation and evaluation correctly, including all current lisp descendants. It is essentially a lisp but hidden behind `' rather than ().
- zokier 3y ago> Apparently someone at Bell labs needed a preprocessor and wrote M4, sometimes in the '70, for no other greater purpose than to scratch a personally itch. That covers pretty much all of unix. Some people treat unix as if it had some grand design behind it, but really most of it is just a pile ad-hoc hacks stretched way beyond their original intent and later immortalized by backwards compat and inertia.
- chipdart 3y ago> That covers pretty much all of unix. I think Unix critics completely miss the point. Contrary to your claim, Unix's basic architecture principles were proven to be key to it's success. Contrary to your claim, this does not mean each tool and interface defines the gold standard for operating systems. Since then we have half a century of advances in ergonomics, developer experience, and software engineering, which Unix developers didn't had back then. More importantly, what you are missing is the myriad of alternatives to Unix that were developed since Unix was specified in POSIX, and how each and every single one of them is an utter and complete failure in representing a better alternative to Unix. A lot of them claim to do things in a better way, but in practice none of them ever delivered anything remotely capable. Unix is the poster child of "x is the worst, except for every single other alternative".
- musicale 3y ago> someone at Bell Labs "Kernighan and Ritchie then joined forces to develop the original m4, described in “The M4 Macro Processor” Those nobodies. What were they thinking? > for no other greater purpose than to scratch a personally itch "The Brian Kernighan and P.J. Plauger book Software Tools, Addison-Wesley (1976), describes and implements a Unix macro-processor language, which inspired Dennis Ritchie to write m3"[1] "Originally, the Kernighan and Plauger macro-processor, and then m3, formed the engine for the Rational FORTRAN preprocessor, that is, the Ratfor equivalent of cpp. Later, m4 was used as a front-end for Ratfor, C and Cobol."[1] If the m3/m4 folks wrote a whole "Software Tools" book and then used m4 as a front-end for multiple languages, it sounds like it served a useful purpose. [1] GNU M4 manual section 1.2, "Historical References"
- okasaki 3y agoI vaguely remember using m4 to generate my website, and it worked pretty well for that.
- quintussss 3y agoI worked at a company that heavily used M4 for generating header files and I hated it. The syntax is just awful.
- xlii 3y agoI would really want to have something like M4 for modern workflows. Quite often I face problem of making solution consistent across multiple domains. E.g. Having logic in X, updating docs in Y through markdown, specs in Z, specs consuming in Q etc. in isolated systems that don’t share anything more than a conceptual logic. Doing anything that oraz feels like XKCD problem as in th risk of building S+1 standard solution. Researching, I’ve seen configuration languages, in-house hacks and more. I also looked at M4 at some point and it felt dated and hard to integrate. But I think world is ripe for general purpose, typed, macro solution. Seems that typescript fills that gap but TBH I’d expect something like nix get there first.
- deleted 3y ago[deleted]
- chipdart 3y agoFrom the post: > GNU M4 only exists because RMS wanted GNU to have what Unix had, and while I wanted to do something different and better, RMS convinced me to do M4 first. This remark sounds awfully ignorant and clueless, and with accusatory tones with w whiff of a personal attack. Unix is specified in a set of international standards which specify exactly what interfaces must exist. This also includes key tools such as M4. https://en.wikipedia.org/wiki/POSIX https://en.wikipedia.org/wiki/POSIX If your goal is to implement an operating system that is focused on interoperability, and in the process reuse the whole ecosystem developed around it, you implement the whole set of interfaces. M4 is a part of those interfaces. There is no personal opinion or whim or capricious sadism. You could not have that if ignorant opinions on the optional nature of key components were taken seriously.
- kibibu 3y agoGNU M4 was released several years before the relevant POSIX standard.
- deleted 3y ago[deleted]
- arp242 3y agoThere's a bunch of stuff in POSIX no one really implements. Pax and SCCS spring to mind (although SCCS is optional, IIRC). I'm sure there's more you will find missing on a fair number of modern systems. And the person who was there says "Stallman wanted X because Y". That there may be other good reasons for X is besides the point, but recollecting the argument at the time doesn't make one " ignorant and clueless". What a ridiculous comment. Furthermore, in a quick search it seems that m4 wasn't added to POSIX until the early 90s. So that makes it doubly besides the point and doubly ridiculous.
- fanf2 3y agopax is in all the BSDs - an implementation was included in 4.4BSD. libarchive implements the pax file format, so bsdtar and bsdcpio can handle pax files.
- fanf2 3y agom4 comes from an ancient lineage of macro processors going back to the early 1960s. There’s a nice summary of the history in the m4 manual, https://www.gnu.org/software/m4/manual/html_node/History.html https://www.gnu.org/software/m4/manual/html_node/History.htm... A big weirdness is that argument separators are identified after macros in the argument list have been expanded, which makes it difficult to understand a macro invocation by itself. The POSIX specification seems to erroneously say that arguments are not subject to macro expansion https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m4.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m... whereas the 7th edition manual clearly says they are https://man.cat-v.org/unix_7th/1/m4 https://man.cat-v.org/unix_7th/1/m4