in reply to Re: Code Generators as tests.
in thread Code Generators as tests.

Until fairly recently, I'd have agreed with you. However, I think it is human nature that is broken, not my code generation environments :-). In my experence, once you start programming with meta data, the meta deta evolves to become turing complete. People want to have conditionals (and later, iteration) within the abstraction that they are concentrating on. And "people" includes me!

Smart generators may be able to avoid regenerating files that don't change; but many versions of "make" are dumb: they see the dependency in the DAG and follow it all the way up: they don't check to see if the output really changed at a given step.

I am not really suggesting that you put generated code in the source control system: I'm suggesting that you put source code in it. The fact that you used an automated partner to help you write that code is unimportant.

I am very aware of the the tendency for the checked-in and generated codes to diverge: that's what the tests are for. They fail when the two are different. At that point, there's a choice: either fix the test (i.e. the generator), or throw it away (the generator was just a wizard). --Dave