
"Andrei Alexandrescu (See Website For Email)" wrote
Here's what I think. I am trying to encourage everyone - and yes, that includes myself - to think out of the box. It's very easy to say something cannot be done, or can only be done some cumbersome way. But usually, those answers come from straight within the box. And they come with the entire garnishment of irony, sarcasm, "proofs", what have you. But once we stop glorifying the box and decide to get out of it, solutions will be found - and they might even be better. :o)
Any solution that would 1) allow for non-trivial code generation based on the user input, and 2) would not require end users to download external tools, would be fine with me. Right now I can only see one such solution, but maybe I am missing something. And I am not saying that what we have now is perfect. The biggest problem with PP and Boost PP, IMO, is re-entrancy issues that are caused by the lack of recursion in PP. Just allowing recursion for function-like macros would make our lifes a lot easier. Limitations caused by the fact that inside Boost PP the repetition is done manually, also dont make one too happy. My whole point is, that _today_, despite all the problems, Boost PP proves to be a very poverful tool allowing non-trivial code generation. If something like this existed 10 years ago, we would need neither MFC class wizards nor IDL compiler. Is it "cumbersome"? I don't know -- is template metaprogramming "cumbersome"? I really believe they are very much alike. Both were not in the initial design, both were later discovered, and both are now "glorified" by some people, and hated by the others. IMO, both are not perfect (something seldom is perfect, if it's not in the initial design), but OK -- they allow to achieve pretty interesting effect, especially if used together. Recall, that the discussion started with me trying to argue with the point that "macros are bad because they are bad". I am just saying that today such a point is no longer axiomatic -- it needs to be proven. The prove for me would include providing a better alternative. Regards, Arkadiy