-
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
reflect-cpp
A C++20 library for fast serialization, deserialization and validation using reflection. Supports JSON, Avro, BSON, Cap'n Proto, CBOR, flexbuffers, msgpack, TOML, UBJSON, XML, YAML / msgpack.org[C++20]
In general, a macro produces code at compile time, doesn't matter in which form it ends up in the binary, as long as the observable side effects are the same.
Example of a library that generates serialization code, https://github.com/getml/reflect-cpp
As mentioned the ongoing C++26 proposal with produce the desired source code at compile time, thus reducing the amount of code of libraries such that one.
-
ultisnips
UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
Let’s say, you’re writing a web application. In most programming language you’d be using libraries or rely on a framework. With Lisp macros, you can program the archetype of a web application. And then use a simpler language to describe you application. Think of it as programmable snippets. Something like Ultisnips [0], but inherent to the language.
[0]: https://github.com/SirVer/ultisnips
-
One example is the ~use-package~ macro (Emacs plugin) [0]. Using packages in emacs is mostly the same code over and over. They've already been abstracted in functions, but you still find yourself juggling with so many utilities. You could write a bigger functions, but it will then have a lot of conditional branches. This macro selectively select the code it needs and transforming it if needs be and then the result will be evaluated.
It's a bit hard to explain for me (English is not my native language). But it's the difference between coding a solution will all the edge cases baked in and coding an archetype that let you add your own cases. With functions, you abstract common algorithms, with macros you abstract common architecture.
[0] https://github.com/jwiegley/use-package/blob/a6e856418d2ebd0...
-
It actually would! There are a handful of base-10 arbitrary precision arithmetic implementations in the preprocessor[1], and modern continuation-passing style macro metaprogramming[2] makes it straightforward to write a function like factorial once you get the syntax and semantics down.
Libraries like Boost.Preprocessor can’t be taken as an example of “cutting edge” preprocessor metaprogramming. It set a very low bar, and IMO has stifled a lot of developer creativity.
[1] https://github.com/rofl0r/chaos-pp/tree/master/chaos/preproc...
-
[2] https://github.com/rofl0r/order-pp/blob/master/example/fibon...