Hacker News new | ask | show | jobs
by maccard 1476 days ago
I fundamentally disagree. The reason programming languages work are because things are consistent, if everyone defined their own flavor of keywords then you're not using the same language anymore. On any project I've worked on I would fail a code review for attempting to introduce something like this.
1 comments

He is consistent, all functions have that keyword, it's his codebase. He has also has the api(custom) define so his metaprogram knows which functions to publish into the plugin system. C++ syntax is not very regular so if you want to consistently catch all functions with a homemade parser or grep or whatever it would need to be complex, it needs to do backtracking, account for stuff like operator+ etc. If you do what he is doing it's trivial to make a metaprogram for C++ that would consistently catch all functions.

It's great that you would fail a code review in your company for that but it's not relevent.

The API custom define is perfectly fine. (Well it sucks but that's not his fault, that's a c++ language deficiency). But making custom defines for fundamental types and for language keywords because you'd rather type internal than static is just messy.
Well, I guess at this point the only thing I can say is: I disagree.