4 ms·
if you don't give a preprocessor to people they will either hack it (see cpp being used for parsing .Xresources and affiliated) or write their custom preprocess
by jcelerier 6y ago
if you don't give a preprocessor to people they will either hack it (see cpp being used for parsing .Xresources and affiliated) or write their custom preprocessor in an unholy mess of bash / python / ruby / cmake anyways.
- andrepd 6y agoWhy? Anything you want to do on a textual preprocessor you can also do on an AST rewriter (like ocaml ppx or rust macros).
- a1369209993 6y ago> Anything you want to do on a textual preprocessor you can also do on an AST rewriter That is blatantly and obviously false: #define BEGIN { #define END } int main(void) BEGIN int x = 0; return x; END
- sebbertsen 6y agoI don't want to do that
- nemetroid 6y agoThey said "want", not "can".
- jcelerier 6y agobut can you do it in a couple lines of ugly hacks or grep/awk/sed scripts at 02:35 AM when shit hits the fan ?
- dnautics 6y agoYeah when the shit hits the fan, you do this deploy, and at 5:00 am you realize that you forgot that your prepro macro was supposed to be a pseudo function and you shouldn't have put a semicolon in there what do you do?
- rixed 6y agoLet's never assume we can know what anyone will ever legitimately want to do. One of the use cases of preprocessors is to accommodate several versions of the language. Obviously, if the AST changes between versions, then no AST rewriter can help. We have had to bake our own ad-hoc simple preprocessor for OCaml to accommodate various versions of its stdlib API, for instance.
- lmm 6y agoNot if you're a decent language that can fulfil their use cases without needing a preprocessor.