This is a strong example for the distinction between abundant comments and good documentation. Comments should describe why and how, not what. Comments on every single line stating what the line is doing is rarely a good sign. Despite all the comments, it's not super clear what it actually does from a user perspective and why someone would want to use it. I assume it's meant to be a templating system for text documents.
Programming
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
I forgot to mention, tools like Bison and Autoconf use m4. Andrew Appel calls languages that need preprocessing 'weak'. The specs for D also call C 'weak' for needing to be preprocessed. Preprocessing is almost an abandoned practice, at least in the world of programming, because Scheme-like 'hygenic macros' have taken their place. Some languages like Rust and Zig are attempting to reinvent the wheel by re-inventing macros, but Scheme had it right in the 70s. Truly, C and Pascal's preprocessor were out the door in the 70s, let alone, now.
Here's another preprocessor that is 'neat: GPP.
I have made my own preprocessor, it's very nasty and has a lot of bugs because I was an idiot when I made it: https://github.com/Chubek/Ekipp
I have half a mind to remake Ekipp. I don't know what purpose would it serve. But it's just neat, I think preprocessors are neat, as useless as they are.
It does not really need to explain what it 'is' because
1- a paper has been released on ACM explaining it, you can download it for free from here: https://dl.acm.org/doi/pdf/10.1145/353474.353484
2- It's name is m5, most people in the UNIX world know what m4 is. If you have Linux, bring up info m4
.
Imagine this, when you use C, there is a preprocessor that does all the #include
and #define
s, m4 is like that and m5 is like that too. Preprocessing used to be big, but now it's not. If you wanna see an example of preprocessing, look at this preprocessor I made for C:
https://gist.github.com/Chubek/b2846855e5bb71a67c7e3effc6beefd6
I am too dumb for this. Can somebody give an example of how this could be used in a real world scenario?
If only this post title had received descriptive text too