[Haskell-cafe] Code that writes code

Antoine Latter aslatter at gmail.com
Tue Aug 24 18:22:25 EDT 2010

In the past I've taken a hybrid approach - ad-hoc fixes are done to the
generated code, but it is done via 'patch' as an automated step, and the
diff is stored in source control with everything else.

You'll need extra tool support to build the diff, as well.

It's still really brittle, and I would only recommend it if you don't own
the input data you're generating from, and other consummers rely on it being
in its current state.

Take care,

On Aug 24, 2010 4:51 PM, "Richard O&apos;Keefe" <ok at cs.otago.ac.nz> wrote:
> On Aug 22, 2010, at 7:34 PM, Jesse Schalken wrote:
>> I would also like to strongly discourage code generators.
> I've used ad hoc code generators a lot, and never had
> reason to regret it.
> The key point is that ALL maintenance of the generated code
> must be done by maintaining the generator and its input,
> NOT by patching the output.
>> Every software project which I've worked on that used a code generator
>> turned into a nightmare, because when we find we need to change
>> something about the generator's output, all the already generated code
>> has to be updated manually while at the same time maintaining all of the
>> unique modifications that have been since the code was first generated.
>> It's a horrible duplication of program logic and maintenance work.
> If you need to change something about a generator's output,
> you do it (always!) by changing the generator's input, or by
> changing the generator. Then you *re*generate the code.
> There should never *be* any "unique modifications" to the output
> of a code generator.
>> Of course code generation is perfectly fine when the output is not
>> intended to be read and maintained by a human.
> "Read" and "maintained" are two different issues.
> Depending on the tool-chain, it may be necessary for people to
> read the generated code while debugging.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100824/2020b1a2/attachment.html

More information about the Haskell-Cafe mailing list