Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> But when working outside C/C++ I've found myself missing the flexibility of macros more times than I can count.

Me to, and that's even in Lisp!

Preprocessor macros are hard and bugprone because they share the failings of Unix philosophy of "text as universal interface" - you're playing with unstructured (or semi-structured) pieces of text, devoid of all semantics. And this is also what makes them occasionally useful - some code transformations are much, much easier to do when you can manipulate the text form directly, ignoring syntax and grammar and everything.

Only the final value must be correct code - starting point and intermediary values can be anything, and you don't need to make sure you can get from here to there through valid data transformations. This is a really powerful capability to have.

(I also explicitly compared preprocessor macros to "plaintext everything" experience that's seen as divine wisdom, to say: y'all are slinging unstructured text down the pipes way too much, and using preprocessor way too little.)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: