A tale in 3 pictures.
-
@citizen428 @joe Yeah, sorry, I didn’t mean it as a mark against you either! It just rang a bell, having run into people attempting to do even a less silly thing.
-
@citizen428 @eniko Impressive!


-
@citizen428 @eniko The first words were "WTF????" - that's why the first emoji


-
@necrophcodr Funny you'd say that, because this (`clang -I. -P -E`) but in another context is how this little side quest started.
@citizen428 I mean it has simple uses too, like adding simple include statements in any file, or, as you've shown, macros.
I've used it to make a lockfile for my Containerfile, and I'd just build using cpp -E <file> | docker build -f- <...>
-
The horrors:
C preprocessor abuse
C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.
Gist (gist.github.com)
@citizen428 I highly recommend combining this with a MAP macro.
-
@citizen428 I highly recommend combining this with a MAP macro.
@ryanc Please don’t give me ideas

-
The horrors:
C preprocessor abuse
C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.
Gist (gist.github.com)
@citizen428 omg, you even serve it right from C code?! God, I want to unsee this...
-
A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.
@citizen428 finally, webdev in C
-
@ryanc Please don’t give me ideas

@citizen428 Fine. I will not inflict further ideas upon you, but why do you hate fun?
-
A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.
@citizen428
Finally somebody's optimised CGI.pm's html functions -
A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.
@citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!
It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.
GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration
Penpot: The open-source design tool for design and code collaboration - penpot/penpot
GitHub (github.com)
So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros...

-
@citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!
It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.
GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration
Penpot: The open-source design tool for design and code collaboration - penpot/penpot
GitHub (github.com)
So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros...

@citizen428 this is a real example of the code in the app:
[:div {:class (stl/css :modal-overlay)}
[:div {:class (stl/css :modal-dialog)
:data-testid "token-theme-update-create-modal"}
[:> icon-button* {:class (stl/css :close-btn)
:on-click modal/hide!
:aria-label (tr "labels.close")
:variant "action"
:icon i/close}]
[:> themes-modal-body*]]] -
The horrors:
C preprocessor abuse
C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.
Gist (gist.github.com)
@citizen428 Thanks for sharing the code.
In a weird way, this is exactly what the C preprocessor is designed to do.
I still don't want to debug a bigger website though.

-
@citizen428 Thanks for sharing the code.
In a weird way, this is exactly what the C preprocessor is designed to do.
I still don't want to debug a bigger website though.

@dragonfi@jsteuernagel.de $DEITY no, I'd never want to actually work with this outside of a little late-night hack session.
-
@citizen428 Fine. I will not inflict further ideas upon you, but why do you hate fun?
@ryanc I'm just trying to avoid getting nerd sniped into spending any more time on this. I have a much bigger preprocessor abuse planned

-
@citizen428 @wonka @Lemmus that's exactly the place where it stabs you with a rusty spoon.
-
@citizen428 omg, you even serve it right from C code?! God, I want to unsee this...
@siguza Maximum cursed is what I was going for, so yes. If you prefer CGI and another web server you could use kcgi:
kcgi: minimal CGI and FastCGI library for C/C++
A C/C++ library for security-oriented web applications.
(kristaps.bsd.lv)
-
@citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!
It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.
GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration
Penpot: The open-source design tool for design and code collaboration - penpot/penpot
GitHub (github.com)
So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros...

@hirunatan Yeah, there are plenty of versions of this in all kinds of languages. But most of them have actual syntactic macros working on an AST, not just simple text replacement.
-
@citizen428 finally, webdev in C
@fx You might be the right kind of person to find https://learnbchs.org interesting then.
-
@citizen428 This is extra bad because cpp isn't specified in a way you can necessarily cough up matching text and different compilers resolve that problem in their preprocessed output in different ways...
@malwareminigun Does the first image not make it clear that this is not a serious post?
