X macro in D

Walter Bright newshound2 at digitalmars.com
Sat Aug 20 13:11:43 UTC 2022


The X macro in C is famous:

https://www.digitalmars.com/articles/b51.html

Here's the challenge:

"X-macros in C [1] are great for doing compile-time code generation from tabular 
data. Especially for things like pinouts and their respective capabilities on 
microcontrollers, I haven't seen any other language give such a succinct, easily 
maintainable way of interacting and representing data such that it can be used 
for full function generation that an IDE can autocomplete names, types etc.
Sure there are other "newer" ways but they invariably involve so much 
boilerplate that you might as well just write all the code by hand."

https://news.ycombinator.com/item?id=32530255

Who is up for the challenge?


More information about the Digitalmars-d mailing list